emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Remove XEmacs and ancient Emacs compat code
Date: Sat, 18 Jun 2022 09:08:02 +0200	[thread overview]
Message-ID: <CADwFkmkLZSjHeWtQNzi_1qJ5cJKh9BYZETMyZA1BxtSHnZokbA@mail.gmail.com> (raw)
In-Reply-To: <87fslvus9s.fsf@localhost>

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

Ihor Radchenko <yantar92@gmail.com> writes:

> Stefan Kangas <stefan@marxist.se> writes:
>
> > The attached patch removes some compat code for XEmacs, and Emacs 21/22.
>
> Thanks! And sorry for the late reply.
> The patch does not apply onto current main anymore.
> Would you mind updating the patch?

Please see the attached.

[-- Attachment #2: 0001-Remove-XEmacs-and-ancient-Emacs-compat-code.patch --]
[-- Type: text/x-patch, Size: 12775 bytes --]

From 58a7d4275e2bdff7359ba3ac7b8d89a859d0c242 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Sun, 26 Sep 2021 21:29:25 +0200
Subject: [PATCH] Remove XEmacs and ancient Emacs compat code

* lisp/org-colview.el (org-columns-remove-overlays):
* lisp/org-ctags.el (org-ctags-find-tag-interactive):
* lisp/org-macs.el (org-fit-window-to-buffer):
* lisp/org-mouse.el (org-mouse-show-context-menu):
* lisp/org-table.el (org-table-fedit-lisp-indent):
* lisp/org.el (org-version, org-reload):
* lisp/ox-html.el (org-html-template, org-html--build-meta-info):
Remove Emacs 21 and 22 compat code.

* lisp/ol-eww.el (org-eww-copy-for-org-mode):
* lisp/ol-w3m.el (org-w3m-copy-for-org-mode):
* lisp/org-clock.el (org-clock-select-task):
* lisp/org-macs.el (org-fit-window-to-buffer):
* lisp/org-refile.el (org-refile):
* lisp/org.el (org-change-tag-in-region): Remove XEmacs compat code.

* lisp/org-goto.el (org-goto--set-map):
* lisp/org-macs.el (org-fit-window-to-buffer):
* lisp/org-table.el (orgtbl-mode):
* lisp/org.el (org-setup-filling): Remove XEmacs or Emacs 19 or 20
compat code.  (It is one of these; not clear which.)
---
 lisp/ol-eww.el       |  2 +-
 lisp/ol-w3m.el       |  2 +-
 lisp/org-clock.el    |  1 -
 lisp/org-colview.el  |  3 +--
 lisp/org-ctags.el    |  5 +----
 lisp/org-goto.el     |  6 ++----
 lisp/org-macs.el     | 13 ++++++-------
 lisp/org-mouse.el    |  5 +----
 lisp/org-protocol.el |  1 +
 lisp/org-refile.el   |  2 +-
 lisp/org-table.el    | 12 ++++--------
 lisp/org.el          | 19 ++++++++-----------
 lisp/ox-html.el      |  3 +--
 13 files changed, 28 insertions(+), 46 deletions(-)

diff --git a/lisp/ol-eww.el b/lisp/ol-eww.el
index 23ba8b377..722e2c716 100644
--- a/lisp/ol-eww.el
+++ b/lisp/ol-eww.el
@@ -107,7 +107,7 @@ keep the structure of the Org file."
       (setq transform-start (region-beginning))
       (setq transform-end (region-end))
       ;; Deactivate mark if current mark is activate.
-      (when (fboundp 'deactivate-mark) (deactivate-mark)))
+      (deactivate-mark))
     (message "Transforming links...")
     (save-excursion
       (goto-char transform-start)
diff --git a/lisp/ol-w3m.el b/lisp/ol-w3m.el
index 517329889..80d6811a5 100644
--- a/lisp/ol-w3m.el
+++ b/lisp/ol-w3m.el
@@ -72,7 +72,7 @@ so that it can be yanked into an Org  buffer with links working correctly."
       (setq transform-start (region-beginning))
       (setq transform-end (region-end))
       ;; Deactivate mark if current mark is activate.
-      (when (fboundp 'deactivate-mark) (deactivate-mark)))
+      (deactivate-mark))
     (message "Transforming links...")
     (save-excursion
       (goto-char transform-start)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index b94c79baa..fbbda3b47 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -661,7 +661,6 @@ there is no recent clock to choose from."
 		     (if (< i 10)
 			 (+ i ?0)
 		       (+ i (- ?A 10))) m))
-	    (if (fboundp 'int-to-char) (setf (car s) (int-to-char (car s))))
 	    (push s sel-list)))
 	(run-hooks 'org-clock-before-select-task-hook)
 	(goto-char (point-min))
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index c8443c135..ca64b11aa 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -513,8 +513,7 @@ for the duration of the command.")
 (defun org-columns-remove-overlays ()
   "Remove all currently active column overlays."
   (interactive)
-  (when (and (fboundp 'face-remap-remove-relative)
-	     org-columns-header-line-remap)
+  (when org-columns-header-line-remap
     (face-remap-remove-relative org-columns-header-line-remap)
     (setq org-columns-header-line-remap nil))
   (when org-columns-overlays
diff --git a/lisp/org-ctags.el b/lisp/org-ctags.el
index 59a08d0b5..ccc2dfa22 100644
--- a/lisp/org-ctags.el
+++ b/lisp/org-ctags.el
@@ -509,10 +509,7 @@ Uses `ido-mode' if available.
 If the user enters a string that does not match an existing tag, create
 a new topic."
   (interactive)
-  (let* ((completing-read-fn (if (fboundp 'ido-completing-read)
-                                 'ido-completing-read
-                               'completing-read))
-         (tag (funcall completing-read-fn "Topic: " org-ctags-tag-list
+  (let* ((tag (ido-completing-read "Topic: " org-ctags-tag-list
                        nil 'confirm nil 'org-ctags-find-tag-history)))
     (when tag
       (cond
diff --git a/lisp/org-goto.el b/lisp/org-goto.el
index cd5000037..6162b7dde 100644
--- a/lisp/org-goto.el
+++ b/lisp/org-goto.el
@@ -110,10 +110,8 @@ When nil, you can use these keybindings to navigate the buffer:
 	  (org-defkey map [(down)] 'outline-next-visible-heading)
 	  (org-defkey map [(up)] 'outline-previous-visible-heading)
 	  (if org-goto-auto-isearch
-	      (if (fboundp 'define-key-after)
-		  (define-key-after map [t] 'org-goto-local-auto-isearch)
-		nil)
-	    (org-defkey map "q" 'org-goto-quit)
+              (define-key-after map [t] 'org-goto-local-auto-isearch)
+            (org-defkey map "q" 'org-goto-quit)
 	    (org-defkey map "n" 'outline-next-visible-heading)
 	    (org-defkey map "p" 'outline-previous-visible-heading)
 	    (org-defkey map "f" 'outline-forward-same-level)
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index c34ff3ab7..f364d6176 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -70,6 +70,7 @@
 	     ,@body)
 	 (set-buffer-modified-p ,was-modified)))))
 
+;; FIXME: `partial-completion-mode' is obsolete since Emacs 24.1.
 (defmacro org-without-partial-completion (&rest body)
   (declare (debug (body)))
   `(if (and (boundp 'partial-completion-mode)
@@ -220,14 +221,12 @@ WINDOW defaults to the selected window.  MAX-HEIGHT and MIN-HEIGHT are
 passed through to `fit-window-to-buffer'.  If SHRINK-ONLY is set, call
 `shrink-window-if-larger-than-buffer' instead, the height limit is
 ignored in this case."
-  (cond ((if (fboundp 'window-full-width-p)
-             (not (window-full-width-p window))
-           ;; Do nothing if another window would suffer.
-           (> (frame-width) (window-width window))))
-        ((and (fboundp 'fit-window-to-buffer) (not shrink-only))
+  (cond ((not (window-full-width-p window))
+         ;; Do nothing if another window would suffer.
+         )
+        ((not shrink-only)
          (fit-window-to-buffer window max-height min-height))
-        ((fboundp 'shrink-window-if-larger-than-buffer)
-         (shrink-window-if-larger-than-buffer window)))
+        (t (shrink-window-if-larger-than-buffer window)))
   (or window (selected-window)))
 
 (defun org-buffer-list (&optional predicate exclude-tmp)
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index 912efb770..b9d583e4f 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -217,10 +217,7 @@ this function is called.  Otherwise, the current major mode menu is used."
 	  (sit-for 0))
 	(if (functionp org-mouse-context-menu-function)
 	    (funcall org-mouse-context-menu-function event)
-	  (if (fboundp 'mouse-menu-major-mode-map)
-	      (popup-menu (mouse-menu-major-mode-map) event prefix)
-	    (with-no-warnings ; don't warn about fallback, obsolete since 23.1
-	      (mouse-major-mode-menu event prefix)))))
+          (popup-menu (mouse-menu-major-mode-map) event prefix)))
     (setq this-command 'mouse-save-then-kill)
     (mouse-save-then-kill event)))
 
diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
index 1969f51fe..2f5e0e0c9 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -367,6 +367,7 @@ returned list."
 	  ret)
       l)))
 
+;; `flatten-tree' was added in Emacs 27.1.
 (defalias 'org-protocol-flatten
   (if (fboundp 'flatten-tree) 'flatten-tree
     (lambda (list)
diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 6f2b019ad..af1932687 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -577,7 +577,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
 		     (with-demoted-errors "Bookmark set error: %S"
 		       (bookmark-set bookmark-name))))
 		 (move-marker org-capture-last-stored-marker (point)))
-	       (when (fboundp 'deactivate-mark) (deactivate-mark))
+               (deactivate-mark)
 	       (run-hooks 'org-after-refile-insert-hook)))
 	    (unless org-refile-keep
 	      (if regionp
diff --git a/lisp/org-table.el b/lisp/org-table.el
index c1ea8503d..f91dce109 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3667,8 +3667,6 @@ With prefix ARG, apply the new formulas to the table."
       (goto-char pos)
       (call-interactively 'lisp-indent-line))
      ((looking-at "[$&@0-9a-zA-Z]+ *= *[^ \t\n']") (goto-char pos))
-     ((not (fboundp 'pp-buffer))
-      (user-error "Cannot pretty-print.  Command `pp-buffer' is not available"))
      ((looking-at "[$&@0-9a-zA-Z]+ *= *'(")
       (goto-char (- (match-end 0) 2))
       (setq beg (point))
@@ -5167,15 +5165,13 @@ When LOCAL is non-nil, show references for the table at point."
 		    (concat orgtbl-line-start-regexp "\\|"
 			    auto-fill-inhibit-regexp)
 		  orgtbl-line-start-regexp))
-    (when (fboundp 'font-lock-add-keywords)
-      (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords)
-      (org-restart-font-lock)))
+    (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords)
+    (org-restart-font-lock))
    (t
     (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
     (remove-hook 'before-change-functions 'org-before-change-function t)
-    (when (fboundp 'font-lock-remove-keywords)
-      (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords)
-      (org-restart-font-lock))
+    (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords)
+    (org-restart-font-lock)
     (force-mode-line-update 'all))))
 
 (defun orgtbl-make-binding (fun n &rest keys)
diff --git a/lisp/org.el b/lisp/org.el
index 200500567..220210992 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -358,7 +358,7 @@ In non-interactive uses, a reduced version string is output unless
 FULL is given."
   (interactive (list current-prefix-arg t (not current-prefix-arg)))
   (let ((org-dir (ignore-errors (org-find-library-dir "org")))
-	(save-load-suffixes (when (boundp 'load-suffixes) load-suffixes))
+        (save-load-suffixes load-suffixes)
 	(load-suffixes (list ".el"))
 	(org-install-dir
 	 (ignore-errors (org-find-library-dir "org-loaddefs"))))
@@ -11458,7 +11458,7 @@ This works in the agenda, and also in an Org buffer."
 	 (progn
 	   (message "[s]et or [r]emove? ")
 	   (equal (read-char-exclusive) ?r))))
-  (when (fboundp 'deactivate-mark) (deactivate-mark))
+  (deactivate-mark)
   (let ((agendap (equal major-mode 'org-agenda-mode))
 	l1 l2 m buf pos newhead (cnt 0))
     (goto-char end)
@@ -17908,7 +17908,6 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
 				   feats)))
 		  'string-lessp)
 		 (list "org-version" "org")))
-	 (load-suffixes (when (boundp 'load-suffixes) load-suffixes))
 	 (load-suffixes (if uncompiled (reverse load-suffixes) load-suffixes))
 	 load-uncore load-misses)
     (setq load-misses
@@ -18706,14 +18705,12 @@ assumed to be significant there."
 (defun org-setup-filling ()
   (require 'org-element)
   ;; Prevent auto-fill from inserting unwanted new items.
-  (when (boundp 'fill-nobreak-predicate)
-    (setq-local
-     fill-nobreak-predicate
-     (org-uniquify
-      (append fill-nobreak-predicate
-	      '(org-fill-line-break-nobreak-p
-		org-fill-n-macro-as-item-nobreak-p
-		org-fill-paragraph-with-timestamp-nobreak-p)))))
+  (setq-local fill-nobreak-predicate
+              (org-uniquify
+               (append fill-nobreak-predicate
+                       '(org-fill-line-break-nobreak-p
+                         org-fill-n-macro-as-item-nobreak-p
+                         org-fill-paragraph-with-timestamp-nobreak-p))))
   (let ((paragraph-ending (substring org-element-paragraph-separate 1)))
     (setq-local paragraph-start paragraph-ending)
     (setq-local paragraph-separate paragraph-ending))
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index d25be1b44..32187f191 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1884,7 +1884,6 @@ INFO is a plist used as a communication channel."
 	 ;; empty, which is invalid.
 	 (title (if (org-string-nw-p title) title "&lrm;"))
 	 (charset (or (and org-html-coding-system
-			   (fboundp 'coding-system-get)
 			   (symbol-name
 			    (coding-system-get org-html-coding-system
 					       'mime-charset)))
@@ -2071,7 +2070,7 @@ holding export options."
 	 (format "%s\n"
 		 (format decl
 			 (or (and org-html-coding-system
-				  (fboundp 'coding-system-get)
+                                  ;; FIXME: Use Emacs 22 style here, see `coding-system-get'.
 				  (coding-system-get org-html-coding-system 'mime-charset))
 			     "iso-8859-1"))))))
    (org-html-doctype info)
-- 
2.30.2


  reply	other threads:[~2022-06-18  7:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07  7:55 [PATCH] Remove XEmacs and ancient Emacs compat code Stefan Kangas
2022-04-30  4:09 ` Ihor Radchenko
2022-06-18  7:08   ` Stefan Kangas [this message]
2022-06-18  7:51     ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADwFkmkLZSjHeWtQNzi_1qJ5cJKh9BYZETMyZA1BxtSHnZokbA@mail.gmail.com \
    --to=stefan@marxist.se \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).