[Top][All Lists]

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

bug#13952: 24.3.50; thingatpoint at end of buffer

From: Andreas Röhler
Subject: bug#13952: 24.3.50; thingatpoint at end of buffer
Date: Thu, 14 Mar 2013 13:11:29 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130215 Thunderbird/17.0.3

Am 14.03.2013 11:58, schrieb Leo Liu:
On 2013-03-14 15:14 +0800, address@hidden wrote:
- make an empty buffer
- type a number
- (thing-at-point 'number)

I will install the following fix after syncing up my emacs-24 branch.

=== modified file 'lisp/thingatpt.el'
--- lisp/thingatpt.el   2013-01-01 09:11:05 +0000
+++ lisp/thingatpt.el   2013-03-14 10:54:03 +0000
@@ -182,7 +182,7 @@
  (defun end-of-sexp ()
    "Move point to the end of the current sexp.
  \[This is an internal function.]"
-  (let ((char-syntax (char-syntax (char-after))))
+  (let ((char-syntax (and (char-after) (char-syntax (char-after)))))
      (if (or (eq char-syntax ?\))
            (and (eq char-syntax ?\") (in-string-p)))
        (forward-char 1)


IMO at stake is a thing-at-point misconception in Emacs.

For a buffer-string of length N thing-at-point should only yield results of N 
Now it yields for N+1

Your fix would work with a number followed by a whitespace, but fail with a 
followed by ")" for example.

If in a buffer is just a number "1", nothing else, thing-at-point should return 
that number
 only at pos 1, not from pos 2.

Presently it fails from Pos.2, which would be correct.

Maybe see behavior as implemented here


reply via email to

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