Browse Source

Rename some functions and move some hooks.

* org.el (org-font-lock-hook, org-set-font-lock-defaults): Add
a docstring.
(org-display-inline-remove-overlay): Rename from
`org-display-inline-modification-hook'.
(org-speed-command-activate): Rename from
`org-speed-command-default-hook'.
(org-babel-speed-command-hook): Rename from
`org-babel-speed-command-activate'.

* org-agenda.el (org-agenda-update-agenda-type): Rename from
`org-agenda-post-command-hook'.
(org-agenda-mode): Use the new name.
(org-agenda-post-command-hook): Define as obsolete function.

* org-lparse.el (org-lparse): Temporarily activate the hooks
needed for the ODT conversion.
(org-lparse-preprocess-after-blockquote): Rename from
`org-lparse-preprocess-after-blockquote-hook'.
(org-lparse-strip-experimental-blocks-maybe): Rename from
`org-lparse-strip-experimental-blocks-maybe'.
(org-lparse-preprocess-after-blockquote-hook)
(org-lparse-strip-experimental-blocks-maybe-hook): Define as
obsolete functions.
Bastien Guerry 8 years ago
parent
commit
001d2d92ba
3 changed files with 43 additions and 17 deletions
  1. 7 4
      lisp/org-agenda.el
  2. 20 8
      lisp/org-lparse.el
  3. 16 5
      lisp/org.el

+ 7 - 4
lisp/org-agenda.el

@@ -1970,7 +1970,7 @@ The following commands are available:
   (easy-menu-add org-agenda-menu)
   (if org-startup-truncated (setq truncate-lines t))
   (org-set-local 'line-move-visual nil)
-  (org-add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local)
+  (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)
@@ -7434,11 +7434,14 @@ When called with a prefix argument, include all archive files as well."
 		"")))
   (force-mode-line-update))
 
-(defun org-agenda-post-command-hook ()
+(define-obsolete-function-alias
+  'org-agenda-post-command-hook 'org-agenda-update-agenda-type "24.3")
+
+(defun org-agenda-update-agenda-type ()
+  "Update the agenda type after each command."
   (setq org-agenda-type
 	(or (get-text-property (point) 'org-agenda-type)
-	    (get-text-property (max (point-min) (1- (point)))
-			       'org-agenda-type))))
+	    (get-text-property (max (point-min) (1- (point))) 'org-agenda-type))))
 
 (defun org-agenda-next-line ()
   "Move cursor to the next line, and show if follow mode is active."

+ 20 - 8
lisp/org-lparse.el

@@ -435,6 +435,10 @@ PUB-DIR specifies the publishing directory."
   (let* ((org-lparse-backend (intern native-backend))
 	 (org-lparse-other-backend (and target-backend
 					(intern target-backend))))
+    (add-hook 'org-export-preprocess-hook
+	      'org-lparse-strip-experimental-blocks-maybe)
+    (add-hook 'org-export-preprocess-after-blockquote-hook
+	      'org-lparse-preprocess-after-blockquote)
     (unless (org-lparse-backend-is-native-p native-backend)
       (error "Don't know how to export natively to backend %s" native-backend))
 
@@ -443,7 +447,11 @@ PUB-DIR specifies the publishing directory."
       (error "Don't know how to export to backend %s %s" target-backend
 	     (format "via %s" native-backend)))
     (run-hooks 'org-export-first-hook)
-    (org-do-lparse arg hidden ext-plist to-buffer body-only pub-dir)))
+    (org-do-lparse arg hidden ext-plist to-buffer body-only pub-dir)
+    (remove-hook 'org-export-preprocess-hook
+		 'org-lparse-strip-experimental-blocks-maybe)
+    (remove-hook 'org-export-preprocess-after-blockquote-hook
+		 'org-lparse-preprocess-after-blockquote)))
 
 (defcustom org-lparse-use-flashy-warning nil
   "Control flashing of messages logged with `org-lparse-warn'.
@@ -1712,7 +1720,12 @@ information."
   (org-lparse-end-paragraph)
   (org-lparse-end-list-item (or type "u")))
 
-(defun org-lparse-preprocess-after-blockquote-hook ()
+(define-obsolete-function-alias
+  'org-lparse-preprocess-after-blockquote-hook
+  'org-lparse-preprocess-after-blockquote
+  "24.3")
+
+(defun org-lparse-preprocess-after-blockquote ()
   "Treat `org-lparse-special-blocks' specially."
   (goto-char (point-min))
   (while (re-search-forward
@@ -1725,10 +1738,12 @@ information."
 	 (format "ORG-%s-END %s" (upcase (match-string 2))
 		 (match-string 3))) t t))))
 
-(add-hook 'org-export-preprocess-after-blockquote-hook
-	  'org-lparse-preprocess-after-blockquote-hook)
+(define-obsolete-function-alias
+  'org-lparse-strip-experimental-blocks-maybe-hook
+  'org-lparse-strip-experimental-blocks-maybe
+  "24.3")
 
-(defun org-lparse-strip-experimental-blocks-maybe-hook ()
+(defun org-lparse-strip-experimental-blocks-maybe ()
   "Strip \"list-table\" and \"annotation\" blocks.
 Stripping happens only when the exported backend is not one of
 \"odt\" or \"xhtml\"."
@@ -1743,9 +1758,6 @@ Stripping happens only when the exported backend is not one of
 	(when (member (match-string 1) org-lparse-special-blocks)
 	  (replace-match "" t t))))))
 
-(add-hook 'org-export-preprocess-hook
-	  'org-lparse-strip-experimental-blocks-maybe-hook)
-
 (defvar org-lparse-list-table-p nil
   "Non-nil if `org-do-lparse' is within a list-table.")
 

+ 16 - 5
lisp/org.el

@@ -5861,9 +5861,11 @@ it is installed to be used by font lock.  This can be useful if something
 needs to be inserted at a specific position in the font-lock sequence.")
 
 (defun org-font-lock-hook (limit)
+  "Run `org-font-lock-hook' within LIMIT."
   (run-hook-with-args 'org-font-lock-hook limit))
 
 (defun org-set-font-lock-defaults ()
+  "Set font lock defaults for the current buffer."
   (let* ((em org-fontify-emphasized-text)
 	 (lk org-activate-links)
 	 (org-font-lock-extra-keywords
@@ -17840,10 +17842,13 @@ BEG and END default to the buffer boundaries."
 		(overlay-put ov 'face 'default)
 		(overlay-put ov 'org-image-overlay t)
 		(overlay-put ov 'modification-hooks
-			     (list 'org-display-inline-modification-hook))
+			     (list 'org-display-inline-remove-overlay))
 		(push ov org-inline-image-overlays)))))))))
 
-(defun org-display-inline-modification-hook (ov after beg end &optional len)
+(define-obsolete-function-alias
+  'org-display-inline-modification-hook 'org-display-inline-remove-overlay "24.3")
+
+(defun org-display-inline-remove-overlay (ov after beg end &optional len)
   "Remove inline-display overlay if a corresponding region is modified."
   (let ((inhibit-modification-hooks t))
     (when (and ov after)
@@ -18220,7 +18225,10 @@ If not, return to the original position and throw an error."
 (defvar org-table-auto-blank-field) ; defined in org-table.el
 (defvar org-speed-command nil)
 
-(defun org-speed-command-default-hook (keys)
+(define-obsolete-function-alias
+  'org-speed-command-default-hook 'org-speed-command-activate "24.3")
+
+(defun org-speed-command-activate (keys)
   "Hook for activating single-letter speed commands.
 `org-speed-commands-default' specifies a minimal command set.
 Use `org-speed-commands-user' for further customization."
@@ -18230,7 +18238,10 @@ Use `org-speed-commands-user' for further customization."
     (cdr (assoc keys (append org-speed-commands-user
 			     org-speed-commands-default)))))
 
-(defun org-babel-speed-command-hook (keys)
+(define-obsolete-function-alias
+  'org-babel-speed-command-hook 'org-babel-speed-command-activate "24.3")
+
+(defun org-babel-speed-command-activate (keys)
   "Hook for activating single-letter code block commands."
   (when (and (bolp) (looking-at org-babel-src-block-regexp))
     (cdr (assoc keys org-babel-key-bindings))))
@@ -18249,7 +18260,7 @@ and return nil or a valid handler as appropriate.  Handler could
 be one of an interactive command, a function, or a form.
 
 Set `org-use-speed-commands' to non-nil value to enable this
-hook.  The default setting is `org-speed-command-default-hook'."
+hook.  The default setting is `org-speed-command-activate'."
   :group 'org-structure
   :version "24.1"
   :type 'hook)