GNU bug report logs -
#35491
Subject: 27.0.50; word-at-point, hand over optional argument
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:
> please permit ‘word-at-point’ to hand over optional arg ‘no-properties’
>
> ‘thing-at-point’ comes with an optional argument ‘no-properties’.
> Seems there is no way to set it from calling ‘word-at-point’.
>
> With attached patch:
>
> (setq a (word-at-point t))foo
>
> a ==> "foo"
>
> ;; current constraint:
> (setq b (word-at-point))foo
>
> b ==> #("foo" 0 2 (fontified t) 2 3 (fontified t rear-nonsticky t))
Sure, I guess there's no reason not to. Any problems with the patch
below? (I avoided looking at yours since I recall you have some
philosophical/legal objection to signing copyright papers)
[0001-Accept-NO-PROPERTIES-in-thing-at-point-aliases-Bug-3.patch (text/x-diff, inline)]
From e04036fd70a5c147831f54c18f51f244c22f6291 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Tue, 7 May 2019 18:15:35 -0400
Subject: [PATCH] Accept NO-PROPERTIES in thing-at-point aliases (Bug#35491)
* lisp/thingatpt.el (word-at-point, sentence-at-point): Accept and
pass NO-PROPERTIES to thing-at-point.
* etc/NEWS: Announce change.
---
etc/NEWS | 9 ++++++++-
lisp/thingatpt.el | 8 ++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 9e3559d27e..d8e5cbdd09 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1247,11 +1247,18 @@ automatically updates. In the buffer, you can use 's q' or 's e' to
signal a thread with quit or error respectively, or get a snapshot
backtrace with 'b'.
+
+** thingatpt.el
+
---
-** thingatpt.el supports a new "thing" called 'uuid'.
+*** 'thing-at-point' supports a new "thing" called 'uuid'.
A symbol 'uuid' can be passed to 'thing-at-point' and it returns the
UUID at point.
+---
+*** 'word-at-point' and 'sentence-at-point' accept NO-PROPERTIES.
+Just like 'thing-at-point' itself.
+
** Interactive automatic highlighting
+++
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 26e084320b..60a20e2d18 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -585,13 +585,13 @@ (put 'uuid 'bounds-of-thing-at-point
;; Aliases
-(defun word-at-point ()
+(defun word-at-point (&optional no-properties)
"Return the word at point. See `thing-at-point'."
- (thing-at-point 'word))
+ (thing-at-point 'word no-properties))
-(defun sentence-at-point ()
+(defun sentence-at-point (&optional no-properties)
"Return the sentence at point. See `thing-at-point'."
- (thing-at-point 'sentence))
+ (thing-at-point 'sentence no-properties))
(defun thing-at-point--read-from-whole-string (str)
"Read a Lisp expression from STR.
--
2.11.0
This bug report was last modified 6 years and 10 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.