all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* patch: thingatpt.el usage of char-before and char-after
@ 2007-10-16 14:59 Aaron Hawley
  0 siblings, 0 replies; only message in thread
From: Aaron Hawley @ 2007-10-16 14:59 UTC (permalink / raw)
  To: bug-gnu-emacs

Since char-after and char-before use (point) as their default arguments,
there's no sense specifying it.  Also, I'm pretty confident that
(char-after (1- (point))) is equivalent to (char-before).  I noticed
these in thingatpt.el.  Below is a patch that makes these
simplifications to the library's code.

ChangeLog entry:

2007-10-16  Aaron Hawley  <aaronh@garden.org>

	* thingatpt.el (end-of-sexp, beginning-of-sexp)
	(forward-same-syntax): char-before and char-after use (point) as
	default argument.
	(forward-same-syntax): char-before is syntactic sugar
	for (char-after (1- (point))).

--- orig/lisp/thingatpt.el
+++ mod/lisp/thingatpt.el
@@ -165,7 +165,7 @@
       (nth 3 (parse-partial-sexp (point) orig)))))
 
 (defun end-of-sexp ()
-  (let ((char-syntax (char-syntax (char-after (point)))))
+  (let ((char-syntax (char-syntax (char-after))))
     (if (or (eq char-syntax ?\))
 	    (and (eq char-syntax ?\") (in-string-p)))
 	(forward-char 1)
@@ -174,7 +174,7 @@
 (put 'sexp 'end-op 'end-of-sexp)
 
 (defun beginning-of-sexp ()
-  (let ((char-syntax (char-syntax (char-before (point)))))
+  (let ((char-syntax (char-syntax (char-before))))
     (if (or (eq char-syntax ?\()
 	    (and (eq char-syntax ?\") (in-string-p)))
 	(forward-char -1)
@@ -374,10 +374,10 @@
   (interactive "p")
   (while (< arg 0)
     (skip-syntax-backward
-     (char-to-string (char-syntax (char-after (1- (point))))))
+     (char-to-string (char-syntax (char-before))))
     (setq arg (1+ arg)))
   (while (> arg 0)
-    (skip-syntax-forward (char-to-string (char-syntax (char-after
(point)))))
+    (skip-syntax-forward (char-to-string (char-syntax (char-after))))
     (setq arg (1- arg))))
 
 ;;  Aliases

-- 
 National Gardening Association
 1100 Dorset Street, South Burlington, VT 05403 
 Email: support@garden.org - Web: www.garden.org/
--






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-10-16 14:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-16 14:59 patch: thingatpt.el usage of char-before and char-after Aaron Hawley

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.