all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Delete some Emacs 24 compat code
@ 2022-06-30 11:19 Stefan Kangas
  2022-06-30 13:36 ` Ihor Radchenko
  2022-06-30 15:25 ` Max Nikulin
  0 siblings, 2 replies; 31+ messages in thread
From: Stefan Kangas @ 2022-06-30 11:19 UTC (permalink / raw)
  To: Org-mode

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

The attached patch deletes some Emacs 24 compat code.  Org mode
supports Emacs 26 or later, according to:
https://orgmode.org/worg/org-maintenance.html#emacs-compatibility

[-- Attachment #2: 0001-Delete-some-Emacs-24-compat-code.patch --]
[-- Type: text/x-patch, Size: 11924 bytes --]

From 6e854576494f918c36cdd0ce698793574af494df Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Thu, 30 Jun 2022 13:06:21 +0200
Subject: [PATCH] Delete some Emacs 24 compat code

Org mode supports Emacs 26 or newer:
https://orgmode.org/worg/org-maintenance.html#emacs-compatibility

* lisp/org-compat.el (org-set-transient-map)
(org-font-lock-ensure): Delete compat aliases.  Update callers.
(org-define-error): Redefine as obsolete function alias for
`define-error'.  Update callers.
(string-suffix-p): Delete compatibility definition.
* lisp/org-fold-core.el (org-fold-core--seq-partition): Redefine
as obsolete function alias for `seq-partition'.  Update callers.
* lisp/org-macs.el (org-without-partial-completion): Redefine as
obsolete function alias for `progn'.
---
 lisp/org-clock.el     |  2 +-
 lisp/org-compat.el    | 37 +------------------------------------
 lisp/org-fold-core.el | 24 ++++--------------------
 lisp/org-goto.el      |  2 +-
 lisp/org-macs.el      | 13 +------------
 lisp/org-src.el       |  2 +-
 lisp/org-table.el     |  6 +++---
 lisp/org.el           |  4 ++--
 lisp/ox-html.el       |  2 +-
 lisp/ox-odt.el        |  2 +-
 lisp/ox-org.el        |  2 +-
 lisp/ox.el            |  2 +-
 12 files changed, 18 insertions(+), 80 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 7d99e5087..e0b2d3ce6 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2122,7 +2122,7 @@ fontified, and then returned."
     (org-mode)
     (org-create-dblock props)
     (org-update-dblock)
-    (org-font-lock-ensure)
+    (font-lock-ensure)
     (forward-line 2)
     (buffer-substring (point) (progn
 				(re-search-forward "^[ \t]*#\\+END" nil t)
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index baad39459..85f66587a 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -904,12 +904,6 @@ context.  See the individual commands for more information."
         ((and (eq window-system 'w32) (fboundp 'w32-get-clipboard-data))
          (w32-get-clipboard-data))))
 
-;; `set-transient-map' is only in Emacs >= 24.4
-(defalias 'org-set-transient-map
-  (if (fboundp 'set-transient-map)
-      'set-transient-map
-    'set-temporary-overlay-map))
-
 \f
 ;;; Region compatibility
 
@@ -961,13 +955,6 @@ Pass COLUMN and FORCE to `move-to-column'."
                           string)
   (apply 'kill-new string args))
 
-;; `font-lock-ensure' is only available from 24.4.50 on
-(defalias 'org-font-lock-ensure
-  (if (fboundp 'font-lock-ensure)
-      #'font-lock-ensure
-    (lambda (&optional _beg _end)
-      (with-no-warnings (font-lock-fontify-buffer)))))
-
 ;; `file-local-name' was added in Emacs 26.1.
 (defalias 'org-babel-local-file-name
   (if (fboundp 'file-local-name)
@@ -994,29 +981,7 @@ Pass COLUMN and FORCE to `move-to-column'."
            (defun org-release () "N/A")
            (defun org-git-version () "N/A !!check installation!!"))))))
 
-
-\f
-;;; Functions for Emacs < 24.4 compatibility
-
-(defun org-define-error (name message)
-  "Define NAME as a new error signal.
-MESSAGE is a string that will be output to the echo area if such
-an error is signaled without being caught by a `condition-case'.
-Implements `define-error' for older emacsen."
-  (if (fboundp 'define-error) (define-error name message)
-    (put name 'error-conditions
-         (copy-sequence (cons name (get 'error 'error-conditions))))))
-
-(unless (fboundp 'string-suffix-p)
-  ;; From Emacs subr.el.
-  (defun string-suffix-p (suffix string  &optional ignore-case)
-    "Return non-nil if SUFFIX is a suffix of STRING.
-If IGNORE-CASE is non-nil, the comparison is done without paying
-attention to case differences."
-    (let ((start-pos (- (length string) (length suffix))))
-      (and (>= start-pos 0)
-           (eq t (compare-strings suffix nil nil
-                                  string start-pos nil ignore-case))))))
+(define-obsolete-function-alias 'org-define-error #'define-error "9.6")
 
 \f
 ;;; Integration with and fixes for other packages
diff --git a/lisp/org-fold-core.el b/lisp/org-fold-core.el
index 88072852d..287686c01 100644
--- a/lisp/org-fold-core.el
+++ b/lisp/org-fold-core.el
@@ -1304,25 +1304,9 @@ property, unfold the region if the :fragile function returns non-nil."
                    ;; Move to next fold.
                    (setq pos (org-fold-core-next-folding-state-change spec pos local-to))))))))))))
 
-;;; Hanlding killing/yanking of folded text
-
-;; Backward compatibility with Emacs 24.
-(defun org-fold-core--seq-partition (list n)
-  "Return list of elements of LIST grouped into sub-sequences of length N.
-The last list may contain less than N elements.  If N is a
-negative integer or 0, nil is returned."
-  (if (fboundp 'seq-partition)
-      (seq-partition list n)
-    (unless (< n 1)
-      (let ((result '()))
-        (while list
-          (let (part)
-            (dotimes (_ n)
-              (when list (push (car list) part)))
-            (push part result))
-          (dotimes (_ n)
-            (setq list (cdr list))))
-        (nreverse result)))))
+;;; Handling killing/yanking of folded text
+
+(define-obsolete-function-alias 'org-fold-core--seq-partition #'seq-partition "9.6")
 
 ;; By default, all the text properties of the killed text are
 ;; preserved, including the folding text properties.  This can be
@@ -1386,7 +1370,7 @@ The arguments and return value are as specified for `filter-buffer-substring'."
                  ;; Yes, it is a hack.
                  ;; The below gives us string representation as a list.
                  ;; Note that we need to remove unreadable values, like markers (#<...>).
-                 (org-fold-core--seq-partition
+                 (seq-partition
                   (cdr (let ((data (read (replace-regexp-in-string
                                           "^#(" "("
                                           (replace-regexp-in-string
diff --git a/lisp/org-goto.el b/lisp/org-goto.el
index 6162b7dde..4eb361558 100644
--- a/lisp/org-goto.el
+++ b/lisp/org-goto.el
@@ -155,7 +155,7 @@ When nil, you can use these keybindings to navigate the buffer:
     (when (eq (lookup-key isearch-mode-map keys) 'isearch-printing-char)
       (isearch-mode t)
       (isearch-process-search-char (string-to-char keys))
-      (org-font-lock-ensure))))
+      (font-lock-ensure))))
 
 (defun org-goto-ret (&optional _arg)
   "Finish `org-goto' by going to the new location."
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index da68d8b8f..07c177b0b 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -70,18 +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)
-	    partial-completion-mode
-	    (fboundp 'partial-completion-mode))
-       (unwind-protect
-	   (progn
-	     (partial-completion-mode -1)
-	     ,@body)
-	 (partial-completion-mode 1))
-     ,@body))
+(define-obsolete-function-alias 'org-without-partial-completion 'progn "9.6")
 
 (defmacro org-with-point-at (pom &rest body)
   "Move to buffer and point of point-or-marker POM for the duration of BODY."
diff --git a/lisp/org-src.el b/lisp/org-src.el
index 58e5b252a..970663e6d 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -636,7 +636,7 @@ as `org-src-fontify-natively' is non-nil."
 	    ;; Add string and a final space to ensure property change.
 	    (insert string " "))
 	  (unless (eq major-mode lang-mode) (funcall lang-mode))
-	  (org-font-lock-ensure)
+          (font-lock-ensure)
 	  (let ((pos (point-min)) next)
 	    (while (setq next (next-property-change pos))
 	      ;; Handle additional properties from font-lock, so as to
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 54e2df20b..e84c2090f 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -4079,7 +4079,7 @@ COLUMNS is a sorted list of column numbers.  BEG and END are,
 respectively, the beginning position and the end position of the
 table."
   (org-with-wide-buffer
-   (org-font-lock-ensure beg end)
+   (font-lock-ensure beg end)
    (dolist (c columns)
      (goto-char beg)
      (let ((align nil)
@@ -4201,7 +4201,7 @@ beginning and end position of the current table."
      (org-table-expand begin end)
      ;; Make sure invisible characters in the table are at the right
      ;; place since column widths take them into account.
-     (org-font-lock-ensure begin end)
+     (font-lock-ensure begin end)
      (org-table--shrink-columns (sort columns #'<) begin end))))
 
 ;;;###autoload
@@ -4333,7 +4333,7 @@ FIELD is a string.  WIDTH is a number.  ALIGN is either \"c\",
     (org-table-save-field
      ;; Make sure invisible characters in the table are at the right
      ;; place since column widths take them into account.
-     (org-font-lock-ensure beg end)
+     (font-lock-ensure beg end)
      (move-marker org-table-aligned-begin-marker beg)
      (move-marker org-table-aligned-end-marker end)
      (goto-char beg)
diff --git a/lisp/org.el b/lisp/org.el
index 8b090ac0b..3bba06d18 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5751,7 +5751,7 @@ needs to be inserted at a specific position in the font-lock sequence.")
     (insert s)
     (let ((org-odd-levels-only odd-levels))
       (org-mode)
-      (org-font-lock-ensure)
+      (font-lock-ensure)
       (if org-link-descriptive
           (org-link-display-format
            (buffer-string))
@@ -14129,7 +14129,7 @@ days in order to avoid rounding problems."
   "Convert a timestamp string S into a number of seconds."
   (float-time (org-time-string-to-time s)))
 
-(org-define-error 'org-diary-sexp-no-match "Unable to match diary sexp")
+(define-error 'org-diary-sexp-no-match "Unable to match diary sexp")
 
 (defun org-time-string-to-absolute (s &optional daynr prefer buffer pos)
   "Convert time stamp S to an absolute day number.
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 66d1c5c60..1a239bb01 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2223,7 +2223,7 @@ is the language used for CODE, as a string, or nil."
 		    (funcall lang-mode)
 		    (insert code)
 		    ;; Fontify buffer.
-		    (org-font-lock-ensure)
+                    (font-lock-ensure)
 		    ;; Remove formatting on newline characters.
 		    (save-excursion
 		      (let ((beg (point-min))
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 5483c4504..7e4ae357e 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -3087,7 +3087,7 @@ and prefix with \"OrgSrc\".  For example,
 		 (with-temp-buffer
 		   (insert code)
 		   (funcall lang-mode)
-		   (org-font-lock-ensure)
+                   (font-lock-ensure)
 		   (buffer-string))))
 	 (fontifier (if use-htmlfontify-p 'org-odt-htmlfontify-string
 		      'org-odt--encode-plain-text))
diff --git a/lisp/ox-org.el b/lisp/ox-org.el
index 96d22d178..011d37616 100644
--- a/lisp/ox-org.el
+++ b/lisp/ox-org.el
@@ -328,7 +328,7 @@ Return output file name."
 	   (work-buffer (or visitingp (find-file-noselect filename)))
 	   newbuf)
       (with-current-buffer work-buffer
-        (org-font-lock-ensure)
+        (font-lock-ensure)
         (org-fold-show-all)
         (setq newbuf (htmlize-buffer)))
       (with-current-buffer newbuf
diff --git a/lisp/ox.el b/lisp/ox.el
index c75357b97..8420db7fc 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -4151,7 +4151,7 @@ meant to be translated with `org-export-data' or alike."
 ;; `org-export-data' for further processing, depending on
 ;; `org-export-with-broken-links' value.
 
-(org-define-error 'org-link-broken "Unable to resolve link; aborting")
+(define-error 'org-link-broken "Unable to resolve link; aborting")
 
 (defun org-export-custom-protocol-maybe (link desc backend &optional info)
   "Try exporting LINK object with a dedicated function.
-- 
2.30.2


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

end of thread, other threads:[~2022-08-12  6:32 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-30 11:19 [PATCH] Delete some Emacs 24 compat code Stefan Kangas
2022-06-30 13:36 ` Ihor Radchenko
2022-06-30 13:39   ` Ihor Radchenko
2022-06-30 15:25   ` Stefan Kangas
2022-07-02  4:11     ` Ihor Radchenko
2022-06-30 15:25 ` Max Nikulin
2022-06-30 15:47   ` Ihor Radchenko
2022-06-30 22:46     ` Samuel Wales
2022-07-01  2:45       ` Ihor Radchenko
2022-07-01  3:11         ` Samuel Wales
2022-07-01  4:00           ` Tim Cross
2022-07-01  4:44             ` Samuel Wales
2022-07-17  9:35         ` Bastien Guerry
2022-07-18  1:23           ` Samuel Wales
2022-07-31 12:54           ` Ihor Radchenko
2022-08-08 15:46             ` Bastien
2022-08-08 22:12               ` Tim Cross
2022-08-09  0:41                 ` Bastien
2022-08-10 11:50                   ` Ihor Radchenko
2022-08-11 10:23                     ` Bastien
2022-08-11 11:53                       ` Ihor Radchenko
2022-08-12  6:30                         ` Bastien
2022-08-09 15:58               ` Max Nikulin
2022-08-10  0:06                 ` Tim Cross
2022-08-10  0:59                 ` Tom Gillespie
2022-08-10  1:13                   ` Tim Cross
2022-08-10  4:55                     ` Tom Gillespie
2022-08-10 14:18                       ` Tim Cross
2022-08-11  2:59                         ` Samuel Wales
2022-08-11  5:34                           ` Tim Cross
2022-08-11  5:56                           ` Tim Cross

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.