emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org uses obsolete `filter-buffer-substring-functions` variable
@ 2024-11-03  3:37 Stefan Kangas
  2024-11-03  7:48 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Kangas @ 2024-11-03  3:37 UTC (permalink / raw)
  To: Org-mode

[-- Attachment #1: Type: text/plain, Size: 575 bytes --]

Org uses the obsolete variable `filter-buffer-substring-functions'.
This variable is likely due for deletion in Emacs 31.1.

Usually, compatibility code looks for the new way of doing things, and
then prefers that.  But it seems like someone decided here to look for
the old symbol instead, and prefer that.  Unless I'm missing something,
it seems to me that the code for the _new_ variable has been hitherto
unused.

Could you please take a look to confirm that removing
`filter-buffer-substring-functions' from Emacs won't break your code?
I have attached a diff.

Thanks!

[-- Attachment #2: filter-buffer-substring-functions.diff --]
[-- Type: text/x-patch, Size: 2915 bytes --]

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 6b586899f..ebfccf19e 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2375,14 +2375,8 @@ 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
-  (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))
+  (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
diff --git a/lisp/org-indent.el b/lisp/org-indent.el
index cabed6acf..a0a0740ee 100644
--- a/lisp/org-indent.el
+++ b/lisp/org-indent.el
@@ -193,15 +193,8 @@ during idle time."
     (when org-indent-mode-turns-on-hiding-stars
       (setq-local org-hide-leading-stars t))
     (org-indent--compute-prefixes)
-    (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-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)
@@ -224,13 +217,8 @@ during idle time."
       (set-marker org-indent--initial-marker nil))
     (when (local-variable-p 'org-hide-leading-stars)
       (kill-local-variable 'org-hide-leading-stars))
-    (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-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)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Org uses obsolete `filter-buffer-substring-functions` variable
  2024-11-03  3:37 Org uses obsolete `filter-buffer-substring-functions` variable Stefan Kangas
@ 2024-11-03  7:48 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2024-11-03  7:48 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Org-mode

Stefan Kangas <stefankangas@gmail.com> writes:

> Org uses the obsolete variable `filter-buffer-substring-functions'.
> This variable is likely due for deletion in Emacs 31.1.
>
> Usually, compatibility code looks for the new way of doing things, and
> then prefers that.  But it seems like someone decided here to look for
> the old symbol instead, and prefer that.  Unless I'm missing something,
> it seems to me that the code for the _new_ variable has been hitherto
> unused.

We backported this change from b1d7e58520dc42a4eda902aa934a250fda6a04ca
Emacs commit.

> Could you please take a look to confirm that removing
> `filter-buffer-substring-functions' from Emacs won't break your code?
> I have attached a diff.

Seems good.
We also do not support Emacs 24 anymore, so the compatibility wrapper is
no longer necessary.

Feel free to either install the change on Emacs side or provide a patch
for me to install on Org side.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-03  7:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-03  3:37 Org uses obsolete `filter-buffer-substring-functions` variable Stefan Kangas
2024-11-03  7:48 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).