all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Mark `forward-point' as obsolete.
@ 2009-03-19 12:57 Juanma Barranquero
  2009-03-19 13:35 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Juanma Barranquero @ 2009-03-19 12:57 UTC (permalink / raw)
  To: Emacs developers

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  <lekktu@gmail.com>

	* 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




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

* Re: Mark `forward-point' as obsolete.
  2009-03-19 12:57 Mark `forward-point' as obsolete Juanma Barranquero
@ 2009-03-19 13:35 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2009-03-19 13:35 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Emacs developers

> It is OK to commit this patch?

Yes,


        Stefan




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

end of thread, other threads:[~2009-03-19 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-19 12:57 Mark `forward-point' as obsolete Juanma Barranquero
2009-03-19 13:35 ` Stefan Monnier

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.