emacs-devel
[Top][All Lists]
Advanced

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

Mark `forward-point' as obsolete.


From: Juanma Barranquero
Subject: Mark `forward-point' as obsolete.
Date: Thu, 19 Mar 2009 13:57:47 +0100

It is OK to commit this patch? Not a bug fix, but trivial, and a new
release is a good time to mark things obsolete (that's why I'm
proposing it now instead of waiting after the release).

`forward-point' is a remnant from multibyte changes back in 1997, and
has been equivalent to (+ (point) N) since then (1997-12-29, to be
precise). Also, it is the only forward-* function that does not
actually move the point, so its name is misleading.

In the Emacs sources, there are five uses of it in two files (plus two
additional references in ps-def.el and eshell/em-rebind.el), versus
460 uses of +/- (point). Time to put the poor beast to rest.

    Juanma


2009-03-19  Juanma Barranquero  <address@hidden>

        * subr.el (forward-point): Add obsolescence declaration.

        * paren.el (show-paren-function):
        * simple.el (kill-forward-chars, kill-backward-chars):
         Use (+/- (point) N), instead of `forward-point'.


Index: lisp/subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.634
diff -u -2 -r1.634 subr.el
--- lisp/subr.el        14 Feb 2009 09:06:56 -0000      1.634
+++ lisp/subr.el        19 Mar 2009 12:02:05 -0000
@@ -999,4 +999,5 @@

 (make-obsolete 'char-bytes "now always returns 1." "20.4")
+(make-obsolete 'forward-point "use (+ (point) N) instead." "23.1")

 (defun insert-string (&rest args)
Index: lisp/paren.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/paren.el,v
retrieving revision 1.79
diff -u -2 -r1.79 paren.el
--- lisp/paren.el       5 Jan 2009 03:19:37 -0000       1.79
+++ lisp/paren.el       19 Mar 2009 12:29:06 -0000
@@ -213,7 +213,7 @@
            (let ((from (if (= dir 1)
                            (point)
-                         (forward-point -1)))
+                         (- (point) 1)))
                  (to (if (= dir 1)
-                         (forward-point 1)
+                         (+ (point) 1)
                        (point))))
              (if show-paren-overlay-1
@@ -239,5 +239,5 @@
                        (save-excursion
                          (goto-char pos)
-                         (forward-point (- dir))))))
+                         (- (point) dir)))))
            (if show-paren-overlay
                (move-overlay show-paren-overlay from to (current-buffer))
Index: lisp/simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.976
diff -u -2 -r1.976 simple.el
--- lisp/simple.el      14 Mar 2009 17:43:16 -0000      1.976
+++ lisp/simple.el      19 Mar 2009 12:33:26 -0000
@@ -3104,5 +3104,5 @@
   (if (listp arg) (setq arg (car arg)))
   (if (eq arg '-) (setq arg -1))
-  (kill-region (point) (forward-point arg)))
+  (kill-region (point) (+ (point) arg)))

 ;; Internal subroutine of backward-delete-char
@@ -3110,5 +3110,5 @@
   (if (listp arg) (setq arg (car arg)))
   (if (eq arg '-) (setq arg -1))
-  (kill-region (point) (forward-point (- arg))))
+  (kill-region (point) (- (point) arg)))

 (defcustom backward-delete-char-untabify-method 'untabify




reply via email to

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