From: Stefan Kangas <stefan@marxist.se>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Remove XEmacs and ancient Emacs compat code
Date: Fri, 7 Jan 2022 01:55:54 -0600 [thread overview]
Message-ID: <CADwFkm=0E+1W28C3Tg8GYSr-P2=WtQCNFnhNn3iKOpZXvV4Zmw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 73 bytes --]
The attached patch removes some compat code for XEmacs, and Emacs 21/22.
[-- Attachment #2: 0001-Remove-XEmacs-and-ancient-Emacs-compat-code.patch --]
[-- Type: text/x-diff, Size: 13040 bytes --]
From 5c3e92a1419c27f79c2cb7a47af55dfd846357fa 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/ox-html.el (org-html-template, org-html--build-meta-info):
* 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): 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 | 20 +++++++++-----------
lisp/ox-html.el | 3 +--
13 files changed, 29 insertions(+), 46 deletions(-)
diff --git a/lisp/ol-eww.el b/lisp/ol-eww.el
index 311a82e42..ba6635fa9 100644
--- a/lisp/ol-eww.el
+++ b/lisp/ol-eww.el
@@ -115,7 +115,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 4eee919b0..1bea52f58 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 5104b6b43..387de7cad 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -659,7 +659,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 d6b709f5d..0a5b7120d 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -512,8 +512,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))
(when org-columns-overlays
(when (local-variable-p 'org-previous-header-line-format)
diff --git a/lisp/org-ctags.el b/lisp/org-ctags.el
index 7876c6ef7..5fe9f31be 100644
--- a/lisp/org-ctags.el
+++ b/lisp/org-ctags.el
@@ -510,10 +510,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 c9cf1f6cf..1ddd16d6c 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 bc58883bf..ac790951d 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -64,6 +64,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)
@@ -241,14 +242,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)))
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index 4471d8e8d..c8cd0d418 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 30f5bc040..11a1e5373 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -356,6 +356,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 678759e10..9b963867d 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 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 4eec94cc8..4a0cb5eb3 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3665,8 +3665,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))
@@ -5165,15 +5163,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 55d95560c..cadef2353 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -336,7 +336,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"))))
@@ -4798,6 +4798,7 @@ This is for getting out of special buffers like capture.")
;; Other stuff we need.
(require 'time-date)
+;; `time-subtract' was added in Emacs 25.1.
(unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time))
(when (< emacs-major-version 28) ; preloaded in Emacs 28
(require 'easymenu))
@@ -12158,7 +12159,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)
@@ -18596,7 +18597,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
@@ -19370,14 +19370,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 7fb8fec22..4df0ae03b 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1879,7 +1879,6 @@ INFO is a plist used as a communication channel."
;; empty, which is invalid.
(title (if (org-string-nw-p title) title "‎"))
(charset (or (and org-html-coding-system
- (fboundp 'coding-system-get)
(symbol-name
(coding-system-get org-html-coding-system
'mime-charset)))
@@ -2066,7 +2065,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
next reply other threads:[~2022-01-07 7:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 7:55 Stefan Kangas [this message]
2022-04-30 4:09 ` [PATCH] Remove XEmacs and ancient Emacs compat code Ihor Radchenko
2022-06-18 7:08 ` Stefan Kangas
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='CADwFkm=0E+1W28C3Tg8GYSr-P2=WtQCNFnhNn3iKOpZXvV4Zmw@mail.gmail.com' \
--to=stefan@marxist.se \
--cc=emacs-orgmode@gnu.org \
/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).