emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master d6831d1b0a: subr.el (inhibit-point-motion-hooks): Mark it as obso


From: Stefan Monnier
Subject: master d6831d1b0a: subr.el (inhibit-point-motion-hooks): Mark it as obsolete
Date: Fri, 7 Oct 2022 14:15:49 -0400 (EDT)

branch: master
commit d6831d1b0a18882d688a842721dd1592884a06e2
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    subr.el (inhibit-point-motion-hooks): Mark it as obsolete
    
    When Emacs-25 changed the default of `inhibit-point-motion-hooks` to t,
    /etc/NEWS declared it as obsolete and so did its docstring, but
    it was not marked as obsolete so as not to emit too many warnings
    in code where it was impractical to remove the let-binding while
    keeping backward compatibility with older Emacsen.
    Those backward compatibility issues are not serious any more now that
    Emacs-25 is itself considered old.
    
    * lisp/subr.el (inhibit-point-motion-hooks): Mark it as obsolete.
    * src/textprop.c (inhibit-point-motion-hooks): Don't mention it being
    obsolete in the docstring any more.
    * lisp/simple.el (line-move-1, line-move-finish): Silence warnings.
---
 lisp/simple.el | 69 ++++++++++++++++++++++++++++++----------------------------
 lisp/subr.el   |  7 +++++-
 src/textprop.c | 10 +--------
 3 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 49ce95dfcf..d2dcbe27a0 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7837,6 +7837,7 @@ If NOERROR, don't signal an error if we can't move that 
many lines."
 (defun line-move-1 (arg &optional noerror _to-end)
   ;; Don't run any point-motion hooks, and disregard intangibility,
   ;; for intermediate positions.
+  (with-suppressed-warnings ((obsolete inhibit-point-motion-hooks))
   (let ((outer-ipmh inhibit-point-motion-hooks)
        (inhibit-point-motion-hooks t)
        (opoint (point))
@@ -7961,7 +7962,7 @@ If NOERROR, don't signal an error if we can't move that 
many lines."
               (goto-char npoint)))
            (t
             (line-move-finish (or goal-column temporary-goal-column)
-                              opoint (> orig-arg 0) (not outer-ipmh)))))))
+                              opoint (> orig-arg 0) (not outer-ipmh))))))))
 
 (defun line-move-finish (column opoint forward &optional not-ipmh)
   (let ((repeat t))
@@ -8014,42 +8015,44 @@ If NOERROR, don't signal an error if we can't move that 
many lines."
        ;; unnecessarily.  Note that we move *forward* past intangible
        ;; text when the initial and final points are the same.
        (goto-char new)
-       (let ((inhibit-point-motion-hooks (not not-ipmh)))
-         (goto-char new)
-
-         ;; If intangibility moves us to a different (later) place
-         ;; in the same line, use that as the destination.
-         (if (<= (point) line-end)
-             (setq new (point))
-           ;; If that position is "too late",
-           ;; try the previous allowable position.
-           ;; See if it is ok.
-           (backward-char)
-           (if (if forward
-                   ;; If going forward, don't accept the previous
-                   ;; allowable position if it is before the target line.
-                   (< line-beg (point))
-                 ;; If going backward, don't accept the previous
-                 ;; allowable position if it is still after the target line.
-                 (<= (point) line-end))
-               (setq new (point))
-             ;; As a last resort, use the end of the line.
-             (setq new line-end))))
+       (with-suppressed-warnings ((obsolete inhibit-point-motion-hooks))
+         (let ((inhibit-point-motion-hooks (not not-ipmh)))
+           (goto-char new)
+
+           ;; If intangibility moves us to a different (later) place
+           ;; in the same line, use that as the destination.
+           (if (<= (point) line-end)
+               (setq new (point))
+             ;; If that position is "too late",
+             ;; try the previous allowable position.
+             ;; See if it is ok.
+             (backward-char)
+             (if (if forward
+                     ;; If going forward, don't accept the previous
+                     ;; allowable position if it is before the target line.
+                     (< line-beg (point))
+                   ;; If going backward, don't accept the previous
+                   ;; allowable position if it is still after the target line.
+                   (<= (point) line-end))
+                 (setq new (point))
+               ;; As a last resort, use the end of the line.
+               (setq new line-end)))))
 
        ;; Now move to the updated destination, processing fields
        ;; as well as intangibility.
        (goto-char opoint)
-       (let ((inhibit-point-motion-hooks (not not-ipmh)))
-         (goto-char
-          ;; Ignore field boundaries if the initial and final
-          ;; positions have the same `field' property, even if the
-          ;; fields are non-contiguous.  This seems to be "nicer"
-          ;; behavior in many situations.
-          (if (eq (get-char-property new 'field)
-                  (get-char-property opoint 'field))
-              new
-            (constrain-to-field new opoint t t
-                                'inhibit-line-move-field-capture))))
+       (with-suppressed-warnings ((obsolete inhibit-point-motion-hooks))
+         (let ((inhibit-point-motion-hooks (not not-ipmh)))
+           (goto-char
+            ;; Ignore field boundaries if the initial and final
+            ;; positions have the same `field' property, even if the
+            ;; fields are non-contiguous.  This seems to be "nicer"
+            ;; behavior in many situations.
+            (if (eq (get-char-property new 'field)
+                    (get-char-property opoint 'field))
+                new
+              (constrain-to-field new opoint t t
+                                  'inhibit-line-move-field-capture)))))
 
        ;; If all this moved us to a different line,
        ;; retry everything within that new line.
diff --git a/lisp/subr.el b/lisp/subr.el
index c975c216bb..56ce9fa69b 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1837,7 +1837,12 @@ be a list of the form returned by `event-start' and 
`event-end'."
 (set-advertised-calling-convention 'time-convert '(time form) "29.1")
 
 ;;;; Obsolescence declarations for variables, and aliases.
-
+(make-obsolete-variable
+ 'inhibit-point-motion-hooks
+ "use `cursor-intangible-mode' or `cursor-sensor-mode' instead"
+ ;; It's been announced as obsolete in NEWS and in the docstring since 
Emacs-25,
+ ;; but it's only been marked for compilation warnings since Emacs-29.
+ "25.1")
 (make-obsolete-variable 'redisplay-dont-pause nil "24.5")
 (make-obsolete-variable 'operating-system-release nil "28.1")
 (make-obsolete-variable 'inhibit-changing-match-data 'save-match-data "29.1")
diff --git a/src/textprop.c b/src/textprop.c
index c91a2b729c..c22b579af2 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -2389,15 +2389,7 @@ returned. */);
 
   DEFVAR_LISP ("inhibit-point-motion-hooks", Vinhibit_point_motion_hooks,
               doc: /* If non-nil, don't run `point-left' and `point-entered' 
text properties.
-This also inhibits the use of the `intangible' text property.
-
-This variable is obsolete since Emacs-25.1.  Use `cursor-intangible-mode'
-or `cursor-sensor-mode' instead.  */);
-  /* FIXME: We should make-obsolete-variable, but that signals too many
-     warnings in code which does (let ((inhibit-point-motion-hooks t)) ...)
-     Ideally, make-obsolete-variable should let us specify that only the nil
-     value is obsolete, but that requires too many changes in bytecomp.el,
-     so for now we'll keep it "obsolete via the docstring".  */
+This also inhibits the use of the `intangible' text property.  */);
   Vinhibit_point_motion_hooks = Qt;
 
   DEFVAR_LISP ("text-property-default-nonsticky",



reply via email to

[Prev in Thread] Current Thread [Next in Thread]