Browse Source

Fix whitespace problem with in-buffer settings

Carsten Dominik 15 years ago
parent
commit
256b0dc88a
2 changed files with 9 additions and 6 deletions
  1. 5 0
      lisp/ChangeLog
  2. 4 6
      lisp/org.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2010-05-14  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-file-contents): Improve error message.
+	(org-set-regexps-and-options): Remove spaces at both ends.
+
 2010-05-13  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-docbook.el (org-export-as-docbook-pdf): Improve

+ 4 - 6
lisp/org.el

@@ -4030,10 +4030,9 @@ means to push this value onto the list in the variable.")
 			  (re-search-forward re nil t)))
 	    (setq key (upcase (match-string 1 ext-setup-or-nil))
 		  value (org-match-string-no-properties 2 ext-setup-or-nil))
+	    (if stringp value (setq value (org-trim value)))
 	    (cond
 	     ((equal key "CATEGORY")
-	      (if (string-match "[ \t]+$" value)
-		  (setq value (replace-match "" t t value)))
 	      (setq cat value))
 	     ((member key '("SEQ_TODO" "TODO"))
 	      (push (cons 'sequence (org-split-string value splitre)) kwds))
@@ -4084,8 +4083,7 @@ means to push this value onto the list in the variable.")
 		      (set (make-local-variable var) (symbol-value var))
 		      (add-to-list var val))))))
 	     ((equal key "ARCHIVE")
-	      (string-match " *$" value)
-	      (setq arch (replace-match "" t t value))
+	      (setq arch value)
 	      (remove-text-properties 0 (length arch)
 				      '(face t fontified t) arch))
 	     ((equal key "LATEX_CLASS")
@@ -4291,10 +4289,10 @@ means to push this value onto the list in the variable.")
 	  (not (file-readable-p file)))
       (if noerror
 	  (progn
-	    (message "Cannot read file %s" file)
+	    (message "Cannot read file \"%s\"" file)
 	    (ding) (sit-for 2)
 	    "")
-	(error "Cannot read file %s" file))
+	(error "Cannot read file \"%s\"" file))
     (with-temp-buffer
       (insert-file-contents file)
       (buffer-string))))