]> git.eshelyaron.com Git - emacs.git/commitdiff
Replace some obsolete uses of filter-buffer-substring-functions
authorGlenn Morris <rgm@gnu.org>
Fri, 16 Mar 2018 00:23:09 +0000 (20:23 -0400)
committerAndrew G Cohen <cohen@andy.bu.edu>
Tue, 11 Dec 2018 06:17:50 +0000 (14:17 +0800)
* lisp/org/org-agenda.el (org-agenda-mode):
* lisp/org/org-indent.el (org-indent-mode):
Replace filter-buffer-substring-functions, obsolete since 24.4.

lisp/org/org-agenda.el
lisp/org/org-indent.el

index 9aaec330708ab8c6e56f8fbff94116b8c068bbc4..3d4379b022e920475ea1d851832bef2e2df84b55 100644 (file)
@@ -2201,10 +2201,14 @@ The following commands are available:
   (add-hook 'post-command-hook 'org-agenda-update-agenda-type nil 'local)
   (add-hook 'pre-command-hook 'org-unhighlight nil 'local)
   ;; Make sure properties are removed when copying text
-  (add-hook 'filter-buffer-substring-functions
-           (lambda (fun start end delete)
-             (substring-no-properties (funcall fun start end delete)))
-           nil t)
+  (if (boundp 'filter-buffer-substring-functions)
+      (add-hook 'filter-buffer-substring-functions
+                (lambda (fun start end delete)
+                  (substring-no-properties (funcall fun start end delete)))
+                nil t)
+    ;; Emacs >= 24.4.
+    (add-function :filter-return (local 'filter-buffer-substring-function)
+                  #'substring-no-properties))
   (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))
index ef68c3c4fa7136b3bc0c53fd7a0b14c76ef25b5d..f2cd6a66fb37dc4a2c2522ccb3959de116dfa162 100644 (file)
@@ -183,11 +183,15 @@ during idle time."
                  org-hide-leading-stars)
       (setq-local org-hide-leading-stars t))
     (org-indent--compute-prefixes)
-    (add-hook 'filter-buffer-substring-functions
-             (lambda (fun start end delete)
-               (org-indent-remove-properties-from-string
-                (funcall fun start end delete)))
-             nil t)
+    (if (boundp '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)))
+                 nil t)
+      ;; Emacs >= 24.4.
+      (add-function :filter-return (local 'filter-buffer-substring-function)
+                   #'org-indent-remove-properties-from-string))
     (add-hook 'after-change-functions 'org-indent-refresh-maybe nil 'local)
     (add-hook 'before-change-functions
              'org-indent-notify-modified-headline nil 'local)
@@ -211,10 +215,13 @@ during idle time."
     (when (boundp 'org-hide-leading-stars-before-indent-mode)
       (setq-local org-hide-leading-stars
                  org-hide-leading-stars-before-indent-mode))
-    (remove-hook 'filter-buffer-substring-functions
-                (lambda (fun start end delete)
-                  (org-indent-remove-properties-from-string
-                   (funcall fun start end delete))))
+    (if (boundp 'filter-buffer-substring-functions)
+       (remove-hook 'filter-buffer-substring-functions
+                    (lambda (fun start end delete)
+                      (org-indent-remove-properties-from-string
+                       (funcall fun start end delete))))
+      (remove-function (local 'filter-buffer-substring-function)
+                      #'org-indent-remove-properties-from-string))
     (remove-hook 'after-change-functions 'org-indent-refresh-maybe 'local)
     (remove-hook 'before-change-functions
                 'org-indent-notify-modified-headline 'local)