فهرست منبع

Use `org-add-hook' in some places and merge Emacs revno r112320

* ox.el (org-export-stack-mode)
* org-crypt.el (org-crypt-check-auto-save)
(org-crypt-use-before-save-magic): Use `org-add-hook' when the
hooks are local hooks.

* org-indent.el (org-indent-mode)
* org-agenda.el (org-agenda-mode): Use `org-add-hook' and
merge upstream change from Emacs revno r112320.
Bastien Guerry 12 سال پیش
والد
کامیت
4231cb4b12
4فایلهای تغییر یافته به همراه16 افزوده شده و 16 حذف شده
  1. 4 4
      lisp/org-agenda.el
  2. 6 6
      lisp/org-crypt.el
  3. 5 5
      lisp/org-indent.el
  4. 1 1
      lisp/ox.el

+ 4 - 4
lisp/org-agenda.el

@@ -2148,10 +2148,10 @@ The following commands are available:
   (org-add-hook 'post-command-hook 'org-agenda-update-agenda-type nil 'local)
   (org-add-hook 'pre-command-hook 'org-unhighlight nil 'local)
   ;; Make sure properties are removed when copying text
-  (make-local-variable 'filter-buffer-substring-functions)
-  (add-hook 'filter-buffer-substring-functions
-	    (lambda (fun start end delete)
-	      (substring-no-properties (funcall fun start end delete))))
+  (org-add-hook 'filter-buffer-substring-functions
+		(lambda (fun start end delete)
+		  (substring-no-properties (funcall fun start end delete)))
+		nil t)
   (unless org-agenda-keep-modes
     (setq org-agenda-follow-mode org-agenda-start-with-follow-mode
 	  org-agenda-entry-text-mode org-agenda-start-with-entry-text-mode

+ 6 - 6
lisp/org-crypt.el

@@ -139,11 +139,11 @@ See `org-crypt-disable-auto-save'."
       (message "org-decrypt: Decrypting entry with auto-save-mode enabled.  This may cause leakage."))
      ((eq org-crypt-disable-auto-save 'encrypt)
       (message "org-decrypt: Enabling re-encryption on auto-save.")
-      (add-hook 'auto-save-hook
-		(lambda ()
-		  (message "org-crypt: Re-encrypting all decrypted entries due to auto-save.")
-		  (org-encrypt-entries))
-		nil t))
+      (org-add-hook 'auto-save-hook
+		    (lambda ()
+		      (message "org-crypt: Re-encrypting all decrypted entries due to auto-save.")
+		      (org-encrypt-entries))
+		    nil t))
      (t nil))))
 
 (defun org-crypt-key-for-heading ()
@@ -264,7 +264,7 @@ See `org-crypt-disable-auto-save'."
   "Add a hook to automatically encrypt entries before a file is saved to disk."
   (add-hook
    'org-mode-hook
-   (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t))))
+   (lambda () (org-add-hook 'before-save-hook 'org-encrypt-entries nil t))))
 
 (add-hook 'org-reveal-start-hook 'org-decrypt-entry)
 

+ 5 - 5
lisp/org-indent.el

@@ -182,11 +182,11 @@ during idle time."
       (org-set-local 'org-hide-leading-stars-before-indent-mode
 		     org-hide-leading-stars)
       (org-set-local 'org-hide-leading-stars t))
-    (make-local-variable 'filter-buffer-substring-functions)
-    (add-hook 'filter-buffer-substring-functions
-	      (lambda (fun start end delete)
-		(org-indent-remove-properties-from-string
-		 (funcall fun start end delete))))
+    (org-add-hook 'filter-buffer-substring-functions
+		  (lambda (fun start end delete)
+		    (org-indent-remove-properties-from-string
+		     (funcall fun start end delete)))
+		  nil t)
     (org-add-hook 'after-change-functions 'org-indent-refresh-maybe nil 'local)
     (org-add-hook 'before-change-functions
 		  'org-indent-notify-modified-headline nil 'local)

+ 1 - 1
lisp/ox.el

@@ -5557,7 +5557,7 @@ files or buffers, only the display.
 	header-line-format
 	'(:eval
 	  (format "  %-12s | %6s | %s" "Back-End" "Age" "Source")))
-  (add-hook 'post-command-hook 'org-export-stack-refresh nil t)
+  (org-add-hook 'post-command-hook 'org-export-stack-refresh nil t)
   (set (make-local-variable 'revert-buffer-function)
        'org-export-stack-refresh))