From: Juanma Barranquero <lekktu@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: Mark `forward-point' as obsolete.
Date: Thu, 19 Mar 2009 13:57:47 +0100 [thread overview]
Message-ID: <f7ccd24b0903190557t5808af64gbb67f90adf0b5f55@mail.gmail.com> (raw)
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
next reply other threads:[~2009-03-19 12:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-19 12:57 Juanma Barranquero [this message]
2009-03-19 13:35 ` Mark `forward-point' as obsolete Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f7ccd24b0903190557t5808af64gbb67f90adf0b5f55@mail.gmail.com \
--to=lekktu@gmail.com \
--cc=emacs-devel@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 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.