浏览代码

Bug fix: don't trow an error while trying to complete keywords.

When using `org-complete' on keywords like #+TBLFM, a second call to
`org-complete' would throw an error with no helpful message.  It now
fails silently.

I also moved #+DATE to the list of options, since the user might expect
that using `org-complete' twice on it will insert the default date.

Other changes: removed (current-time) from (format-time-string ...)
sexp since it is not necessary.  As far as I checked, there is no
compatibility issue with this.
Bastien Guerry 17 年之前
父节点
当前提交
07ced08308
共有 2 个文件被更改,包括 23 次插入8 次删除
  1. 10 0
      ChangeLog
  2. 13 8
      org.el

+ 10 - 0
ChangeLog

@@ -1,3 +1,13 @@
+2008-03-19  Bastien Guerry  <bzg@altern.org>
+
+	* org.el (org-complete): Silently fail when trying to complete
+	keywords that don't have a default value.
+	(org-get-current-options): Added a #+DATE: option.
+	(org-additional-option-like-keywords): Removed "DATE:" from the
+	list of additional keywords.
+	(org-export-as-html): Removed (current-time) as unnecessary second
+	argument of `format-time-string'.
+
 2008-03-18  Carsten Dominik  <dominik@science.uva.nl>
 2008-03-18  Carsten Dominik  <dominik@science.uva.nl>
 
 
 	* org.el (org-clock-find-position): Handle special case at end of
 	* org.el (org-clock-find-position): Handle special case at end of

+ 13 - 8
org.el

@@ -10523,7 +10523,7 @@ and TABLE is a vector with line types."
 		    t)))
 		    t)))
       (setq n (1- n)))
       (setq n (1- n)))
     (if (or (< i 0) (>= i l))
     (if (or (< i 0) (>= i l))
-	(error "Row descriptior leads outside table")
+	(error "Row descriptor leads outside table")
       i)))
       i)))
 
 
 (defun org-rewrite-old-row-references (s)
 (defun org-rewrite-old-row-references (s)
@@ -14131,7 +14131,7 @@ This function can be used in a hook."
 
 
 (defconst org-additional-option-like-keywords
 (defconst org-additional-option-like-keywords
   '("BEGIN_HTML" "BEGIN_LaTeX" "END_HTML" "END_LaTeX"
   '("BEGIN_HTML" "BEGIN_LaTeX" "END_HTML" "END_LaTeX"
-    "ORGTBL" "HTML:" "LaTeX:" "BEGIN:" "END:" "DATE:" "TBLFM"
+    "ORGTBL" "HTML:" "LaTeX:" "BEGIN:" "END:" "TBLFM"
     "BEGIN_EXAMPLE" "END_EXAMPLE"))
     "BEGIN_EXAMPLE" "END_EXAMPLE"))
 
 
 (defun org-complete (&optional arg)
 (defun org-complete (&optional arg)
@@ -14215,7 +14215,9 @@ At all other locations, this simply calls the value of
        (cond ((eq completion t)
        (cond ((eq completion t)
 	      (if (not (assoc (upcase pattern) table))
 	      (if (not (assoc (upcase pattern) table))
 		  (message "Already complete")
 		  (message "Already complete")
-		(if (equal type :opt)
+		(if (and (equal type :opt)
+			 (not (member (car (assoc (upcase pattern) table))
+				      org-additional-option-like-keywords)))
 		    (insert (substring (cdr (assoc (upcase pattern) table))
 		    (insert (substring (cdr (assoc (upcase pattern) table))
 				       (length pattern)))
 				       (length pattern)))
 		  (if (memq type '(:tag :prop)) (insert ":")))))
 		  (if (memq type '(:tag :prop)) (insert ":")))))
@@ -24678,9 +24680,9 @@ underlined headlines.  The default is 3."
 
 
     (cond
     (cond
      ((and date (string-match "%" date))
      ((and date (string-match "%" date))
-      (setq date (format-time-string date (current-time))))
+      (setq date (format-time-string date)))
      (date)
      (date)
-     (t (setq date (format-time-string "%Y/%m/%d %X" (current-time)))))
+     (t (setq date (format-time-string "%Y/%m/%d %X"))))
 
 
     (if (and date org-export-time-stamp-file)
     (if (and date org-export-time-stamp-file)
 	(insert (concat (nth 2 lang-words) ": " date"\n")))
 	(insert (concat (nth 2 lang-words) ": " date"\n")))
@@ -24984,6 +24986,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
    "#+TITLE:     %s
    "#+TITLE:     %s
 #+AUTHOR:    %s
 #+AUTHOR:    %s
 #+EMAIL:     %s
 #+EMAIL:     %s
+#+DATE:      %s
 #+LANGUAGE:  %s
 #+LANGUAGE:  %s
 #+TEXT:      Some descriptive text to be emitted.  Several lines OK.
 #+TEXT:      Some descriptive text to be emitted.  Several lines OK.
 #+OPTIONS:   H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s -:%s f:%s *:%s TeX:%s LaTeX:%s skip:%s d:%s tags:%s
 #+OPTIONS:   H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s -:%s f:%s *:%s TeX:%s LaTeX:%s skip:%s d:%s tags:%s
@@ -24997,7 +25000,9 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
 #+ARCHIVE:   %s
 #+ARCHIVE:   %s
 #+LINK:      %s
 #+LINK:      %s
 "
 "
-   (buffer-name) (user-full-name) user-mail-address org-export-default-language
+   (buffer-name) (user-full-name) user-mail-address 
+   (format-time-string (car org-time-stamp-formats))
+   org-export-default-language
    org-export-headline-levels
    org-export-headline-levels
    org-export-with-section-numbers
    org-export-with-section-numbers
    org-export-with-toc
    org-export-with-toc
@@ -25322,9 +25327,9 @@ PUB-DIR is set, use this as the publishing directory."
 
 
     (cond
     (cond
      ((and date (string-match "%" date))
      ((and date (string-match "%" date))
-      (setq date (format-time-string date (current-time))))
+      (setq date (format-time-string date)))
      (date)
      (date)
-     (t (setq date (format-time-string "%Y/%m/%d %X" (current-time)))))
+     (t (setq date (format-time-string "%Y/%m/%d %X"))))
 
 
     ;; Get the language-dependent settings
     ;; Get the language-dependent settings
     (setq lang-words (or (assoc language org-export-language-setup)
     (setq lang-words (or (assoc language org-export-language-setup)