ソースを参照

Fix global dynamic variables in org-agenda.el and org.el.

Thanks to Martyn Jago for preliminary work on this.
Bastien Guerry 13 年 前
コミット
6cbf1f4172
2 ファイル変更38 行追加36 行削除
  1. 4 4
      lisp/org-agenda.el
  2. 34 32
      lisp/org.el

+ 4 - 4
lisp/org-agenda.el

@@ -91,7 +91,7 @@
 (defvar org-agenda-buffer-name)
 (defvar org-agenda-buffer-name)
 (defvar org-agenda-overriding-header)
 (defvar org-agenda-overriding-header)
 (defvar org-agenda-title-append nil)
 (defvar org-agenda-title-append nil)
-(defvar entry)
+(defvar org-entry)
 (defvar date)
 (defvar date)
 (defvar org-agenda-undo-list)
 (defvar org-agenda-undo-list)
 (defvar org-agenda-pending-undo-list)
 (defvar org-agenda-pending-undo-list)
@@ -4530,8 +4530,8 @@ function from a program - use `org-agenda-get-day-entries' instead."
   (org-compile-prefix-format 'agenda)
   (org-compile-prefix-format 'agenda)
   (org-set-sorting-strategy 'agenda)
   (org-set-sorting-strategy 'agenda)
   (setq args (or args '(:deadline :scheduled :timestamp :sexp)))
   (setq args (or args '(:deadline :scheduled :timestamp :sexp)))
-  (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
-		    (list entry)
+  (let* ((files (if (and org-entry (stringp org-entry) (string-match "\\S-" org-entry))
+		    (list org-entry)
 		  (org-agenda-files t)))
 		  (org-agenda-files t)))
 	 (time (org-float-time))
 	 (time (org-float-time))
 	 file rtn results)
 	 file rtn results)
@@ -4936,7 +4936,7 @@ holiday will also be skipped."
 	   (not (member (car (calendar-iso-from-absolute d)) skip-weeks))))
 	   (not (member (car (calendar-iso-from-absolute d)) skip-weeks))))
      (not (and (memq 'holidays skip-weeks)
      (not (and (memq 'holidays skip-weeks)
 	       (calendar-check-holidays date)))
 	       (calendar-check-holidays date)))
-     entry)))
+     org-entry)))
 
 
 (defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks)
 (defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks)
   "Like `org-class', but honor `calendar-date-style'.
   "Like `org-class', but honor `calendar-date-style'.

+ 34 - 32
lisp/org.el

@@ -4841,8 +4841,8 @@ This is for getting out of special buffers like remember.")
 
 
 ;; FIXME: Occasionally check by commenting these, to make sure
 ;; FIXME: Occasionally check by commenting these, to make sure
 ;;        no other functions uses these, forgetting to let-bind them.
 ;;        no other functions uses these, forgetting to let-bind them.
-(defvar entry)
-(defvar last-state)
+(defvar org-entry)
+(defvar org-last-state)
 (defvar date)
 (defvar date)
 
 
 ;; Defined somewhere in this file, but used before definition.
 ;; Defined somewhere in this file, but used before definition.
@@ -4892,6 +4892,8 @@ sure that we are at the beginning of the line.")
   "Matches an headline, putting stars and text into groups.
   "Matches an headline, putting stars and text into groups.
 Stars are put in group 1 and the trimmed body in group 2.")
 Stars are put in group 1 and the trimmed body in group 2.")
 
 
+(defvar buffer-face-mode-face)
+
 ;;;###autoload
 ;;;###autoload
 (define-derived-mode org-mode outline-mode "Org"
 (define-derived-mode org-mode outline-mode "Org"
   "Outline-based notes management and organizer, alias
   "Outline-based notes management and organizer, alias
@@ -10380,8 +10382,8 @@ on the system \"/user@host:\"."
 	targets tgs txt re files f desc descre fast-path-p level pos0)
 	targets tgs txt re files f desc descre fast-path-p level pos0)
     (message "Getting targets...")
     (message "Getting targets...")
     (with-current-buffer (or default-buffer (current-buffer))
     (with-current-buffer (or default-buffer (current-buffer))
-      (while (setq entry (pop entries))
-	(setq files (car entry) desc (cdr entry))
+      (while (setq org-entry (pop entries))
+	(setq files (car org-entry) desc (cdr org-entry))
 	(setq fast-path-p nil)
 	(setq fast-path-p nil)
 	(cond
 	(cond
 	 ((null files) (setq files (list (current-buffer))))
 	 ((null files) (setq files (list (current-buffer))))
@@ -11870,7 +11872,7 @@ of repeating deadline/scheduled time stamps to new date.
 This function is run automatically after each state change to a DONE state."
 This function is run automatically after each state change to a DONE state."
   ;; last-state is dynamically scoped into this function
   ;; last-state is dynamically scoped into this function
   (let* ((repeat (org-get-repeat))
   (let* ((repeat (org-get-repeat))
-	 (aa (assoc last-state org-todo-kwd-alist))
+	 (aa (assoc org-last-state org-todo-kwd-alist))
 	 (interpret (nth 1 aa))
 	 (interpret (nth 1 aa))
 	 (head (nth 2 aa))
 	 (head (nth 2 aa))
 	 (whata '(("d" . day) ("m" . month) ("y" . year)))
 	 (whata '(("d" . day) ("m" . month) ("y" . year)))
@@ -11883,7 +11885,7 @@ This function is run automatically after each state change to a DONE state."
       (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE")
       (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE")
 			 org-todo-repeat-to-state))
 			 org-todo-repeat-to-state))
       (unless (and to-state (member to-state org-todo-keywords-1))
       (unless (and to-state (member to-state org-todo-keywords-1))
-	(setq to-state (if (eq interpret 'type) last-state head)))
+	(setq to-state (if (eq interpret 'type) org-last-state head)))
       (org-todo to-state)
       (org-todo to-state)
       (when (or org-log-repeat (org-entry-get nil "CLOCK"))
       (when (or org-log-repeat (org-entry-get nil "CLOCK"))
 	(org-entry-put nil "LAST_REPEAT" (format-time-string
 	(org-entry-put nil "LAST_REPEAT" (format-time-string
@@ -11897,7 +11899,7 @@ This function is run automatically after each state change to a DONE state."
 		(setq org-log-note-how 'note))
 		(setq org-log-note-how 'note))
 	  ;; Set up for taking a record
 	  ;; Set up for taking a record
 	  (org-add-log-setup 'state (or done-word (car org-done-keywords))
 	  (org-add-log-setup 'state (or done-word (car org-done-keywords))
-			     last-state
+			     org-last-state
 			     'findpos org-log-repeat)))
 			     'findpos org-log-repeat)))
       (org-back-to-heading t)
       (org-back-to-heading t)
       (org-add-planning-info nil nil 'closed)
       (org-add-planning-info nil nil 'closed)
@@ -14899,7 +14901,7 @@ So these are more for recording a certain time/date."
 (defvar org-read-date-analyze-futurep nil)
 (defvar org-read-date-analyze-futurep nil)
 (defvar org-read-date-analyze-forced-year nil)
 (defvar org-read-date-analyze-forced-year nil)
 
 
-(defun org-read-date (&optional with-time to-time from-string prompt
+(defun org-read-date (&optional org-with-time to-time from-string prompt
 				default-time default-input)
 				default-time default-input)
   "Read a date, possibly a time, and make things smooth for the user.
   "Read a date, possibly a time, and make things smooth for the user.
 The prompt will suggest to enter an ISO date, but you can also enter anything
 The prompt will suggest to enter an ISO date, but you can also enter anything
@@ -14953,24 +14955,24 @@ the time/date that is used for everything that is not specified by the
 user."
 user."
   (require 'parse-time)
   (require 'parse-time)
   (let* ((org-time-stamp-rounding-minutes
   (let* ((org-time-stamp-rounding-minutes
-	  (if (equal with-time '(16)) '(0 0) org-time-stamp-rounding-minutes))
+	  (if (equal org-with-time '(16)) '(0 0) org-time-stamp-rounding-minutes))
 	 (org-dcst org-display-custom-times)
 	 (org-dcst org-display-custom-times)
 	 (ct (org-current-time))
 	 (ct (org-current-time))
-	 (def (or org-overriding-default-time default-time ct))
-	 (defdecode (decode-time def))
+	 (org-def (or org-overriding-default-time default-time ct))
+	 (org-defdecode (decode-time org-def))
 	 (dummy (progn
 	 (dummy (progn
-		  (when (< (nth 2 defdecode) org-extend-today-until)
-		    (setcar (nthcdr 2 defdecode) -1)
-		    (setcar (nthcdr 1 defdecode) 59)
-		    (setq def (apply 'encode-time defdecode)
-			  defdecode (decode-time def)))))
+		  (when (< (nth 2 org-defdecode) org-extend-today-until)
+		    (setcar (nthcdr 2 org-defdecode) -1)
+		    (setcar (nthcdr 1 org-defdecode) 59)
+		    (setq org-def (apply 'encode-time org-defdecode)
+			  org-defdecode (decode-time org-def)))))
 	 (calendar-frame-setup nil)
 	 (calendar-frame-setup nil)
 	 (calendar-setup nil)
 	 (calendar-setup nil)
 	 (calendar-move-hook nil)
 	 (calendar-move-hook nil)
 	 (calendar-view-diary-initially-flag nil)
 	 (calendar-view-diary-initially-flag nil)
 	 (calendar-view-holidays-initially-flag nil)
 	 (calendar-view-holidays-initially-flag nil)
 	 (timestr (format-time-string
 	 (timestr (format-time-string
-		   (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") def))
+		   (if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") org-def))
 	 (prompt (concat (if prompt (concat prompt " ") "")
 	 (prompt (concat (if prompt (concat prompt " ") "")
 			 (format "Date+time [%s]: " timestr)))
 			 (format "Date+time [%s]: " timestr)))
 	 ans (org-ans0 "") org-ans1 org-ans2 final)
 	 ans (org-ans0 "") org-ans1 org-ans2 final)
@@ -14983,7 +14985,7 @@ user."
 	  (calendar)
 	  (calendar)
           (unwind-protect
           (unwind-protect
               (progn
               (progn
-		(calendar-forward-day (- (time-to-days def)
+		(calendar-forward-day (- (time-to-days org-def)
 					 (calendar-absolute-from-gregorian
 					 (calendar-absolute-from-gregorian
 					  (calendar-current-date))))
 					  (calendar-current-date))))
 		(org-eval-in-calendar nil t)
 		(org-eval-in-calendar nil t)
@@ -15069,7 +15071,7 @@ user."
 	  (delete-overlay org-read-date-overlay)
 	  (delete-overlay org-read-date-overlay)
 	  (setq org-read-date-overlay nil)))))
 	  (setq org-read-date-overlay nil)))))
 
 
-    (setq final (org-read-date-analyze ans def defdecode))
+    (setq final (org-read-date-analyze ans org-def org-defdecode))
 
 
     (when org-read-date-analyze-forced-year
     (when org-read-date-analyze-forced-year
       (message "Year was forced into %s"
       (message "Year was forced into %s"
@@ -15091,9 +15093,9 @@ user."
 		  (nth 2 final) (nth 1 final))
 		  (nth 2 final) (nth 1 final))
 	(format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final))))))
 	(format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final))))))
 
 
-(defvar def)
-(defvar defdecode)
-(defvar with-time)
+(defvar org-def)
+(defvar org-defdecode)
+(defvar org-with-time)
 (defun org-read-date-display ()
 (defun org-read-date-display ()
   "Display the current date prompt interpretation in the minibuffer."
   "Display the current date prompt interpretation in the minibuffer."
   (when org-read-date-display-live
   (when org-read-date-display-live
@@ -15109,11 +15111,11 @@ user."
     (let* ((ans (concat (buffer-substring (point-at-bol) (point-max))
     (let* ((ans (concat (buffer-substring (point-at-bol) (point-max))
 			" " (or org-ans1 org-ans2)))
 			" " (or org-ans1 org-ans2)))
 	   (org-end-time-was-given nil)
 	   (org-end-time-was-given nil)
-	   (f (org-read-date-analyze ans def defdecode))
+	   (f (org-read-date-analyze ans org-def org-defdecode))
 	   (fmts (if org-dcst
 	   (fmts (if org-dcst
 		     org-time-stamp-custom-formats
 		     org-time-stamp-custom-formats
 		   org-time-stamp-formats))
 		   org-time-stamp-formats))
-	   (fmt (if (or with-time
+	   (fmt (if (or org-with-time
 			(and (boundp 'org-time-was-given) org-time-was-given))
 			(and (boundp 'org-time-was-given) org-time-was-given))
 		    (cdr fmts)
 		    (cdr fmts)
 		  (car fmts)))
 		  (car fmts)))
@@ -15129,7 +15131,7 @@ user."
 	    (make-overlay (1- (point-at-eol)) (point-at-eol)))
 	    (make-overlay (1- (point-at-eol)) (point-at-eol)))
       (org-overlay-display org-read-date-overlay txt 'secondary-selection))))
       (org-overlay-display org-read-date-overlay txt 'secondary-selection))))
 
 
-(defun org-read-date-analyze (ans def defdecode)
+(defun org-read-date-analyze (ans org-def org-defdecode)
   "Analyze the combined answer of the date prompt."
   "Analyze the combined answer of the date prompt."
   ;; FIXME: cleanup and comment
   ;; FIXME: cleanup and comment
   (let ((nowdecode (decode-time (current-time)))
   (let ((nowdecode (decode-time (current-time)))
@@ -15141,7 +15143,7 @@ user."
     (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans)
     (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans)
       (setq ans "+0"))
       (setq ans "+0"))
 
 
-    (when (setq delta (org-read-date-get-relative ans (current-time) def))
+    (when (setq delta (org-read-date-get-relative ans (current-time) org-def))
       (setq ans (replace-match "" t t ans)
       (setq ans (replace-match "" t t ans)
 	    deltan (car delta)
 	    deltan (car delta)
 	    deltaw (nth 1 delta)
 	    deltaw (nth 1 delta)
@@ -15235,19 +15237,19 @@ user."
 			  (substring ans (match-end 7))))))
 			  (substring ans (match-end 7))))))
 
 
     (setq tl (parse-time-string ans)
     (setq tl (parse-time-string ans)
-	  day (or (nth 3 tl) (nth 3 defdecode))
+	  day (or (nth 3 tl) (nth 3 org-defdecode))
 	  month (or (nth 4 tl)
 	  month (or (nth 4 tl)
 		    (if (and org-read-date-prefer-future
 		    (if (and org-read-date-prefer-future
 			     (nth 3 tl) (< (nth 3 tl) (nth 3 nowdecode)))
 			     (nth 3 tl) (< (nth 3 tl) (nth 3 nowdecode)))
 			(prog1 (1+ (nth 4 nowdecode)) (setq futurep t))
 			(prog1 (1+ (nth 4 nowdecode)) (setq futurep t))
-		      (nth 4 defdecode)))
+		      (nth 4 org-defdecode)))
 	  year (or (and (not kill-year) (nth 5 tl))
 	  year (or (and (not kill-year) (nth 5 tl))
 		   (if (and org-read-date-prefer-future
 		   (if (and org-read-date-prefer-future
 			    (nth 4 tl) (< (nth 4 tl) (nth 4 nowdecode)))
 			    (nth 4 tl) (< (nth 4 tl) (nth 4 nowdecode)))
 		       (prog1 (1+ (nth 5 nowdecode)) (setq futurep t))
 		       (prog1 (1+ (nth 5 nowdecode)) (setq futurep t))
-		     (nth 5 defdecode)))
-	  hour (or (nth 2 tl) (nth 2 defdecode))
-	  minute (or (nth 1 tl) (nth 1 defdecode))
+		     (nth 5 org-defdecode)))
+	  hour (or (nth 2 tl) (nth 2 org-defdecode))
+	  minute (or (nth 1 tl) (nth 1 org-defdecode))
 	  second (or (nth 0 tl) 0)
 	  second (or (nth 0 tl) 0)
 	  wday (nth 6 tl))
 	  wday (nth 6 tl))
 
 
@@ -15318,7 +15320,7 @@ user."
       (condition-case nil
       (condition-case nil
 	  (ignore (encode-time second minute hour day month year))
 	  (ignore (encode-time second minute hour day month year))
 	(error
 	(error
-	 (setq year (nth 5 defdecode))
+	 (setq year (nth 5 org-defdecode))
 	 (setq org-read-date-analyze-forced-year t))))
 	 (setq org-read-date-analyze-forced-year t))))
     (setq org-read-date-analyze-futurep futurep)
     (setq org-read-date-analyze-futurep futurep)
     (list second minute hour day month year)))
     (list second minute hour day month year)))