unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* default text-properties-at to use (point)
@ 2019-10-22  9:27 Robert Pluim
  2019-10-22  9:37 ` Andreas Schwab
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Robert Pluim @ 2019-10-22  9:27 UTC (permalink / raw)
  To: emacs-devel

'text-properties-at' is somewhat annoying to use interactively, since
it doesnʼt default to point. How about the following (plus appropriate
doc/NEWS changes)?

diff --git a/src/textprop.c b/src/textprop.c
index 93d19754da..9741099dc4 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -556,8 +556,9 @@ interval_of (ptrdiff_t position, Lisp_Object object)
 }
 \f
 DEFUN ("text-properties-at", Ftext_properties_at,
-       Stext_properties_at, 1, 2, 0,
+       Stext_properties_at, 0, 2, 0,
        doc: /* Return the list of properties of the character at POSITION in OBJECT.
+Optional first arg POSITION nil means use the value of point.
 If the optional second argument OBJECT is a buffer (or nil, which means
 the current buffer), POSITION is a buffer position (integer or marker).
 If OBJECT is a string, POSITION is a 0-based index into it.
@@ -566,6 +567,8 @@ DEFUN ("text-properties-at", Ftext_properties_at,
 {
   register INTERVAL i;
 
+  if (NILP (position))
+      position = Fpoint ();
   if (NILP (object))
     XSETBUFFER (object, current_buffer);
 



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

* Re: default text-properties-at to use (point)
  2019-10-22  9:27 default text-properties-at to use (point) Robert Pluim
@ 2019-10-22  9:37 ` Andreas Schwab
  2019-10-22 12:22   ` Robert Pluim
  2019-10-22  9:39 ` Lars Ingebrigtsen
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2019-10-22  9:37 UTC (permalink / raw)
  To: emacs-devel

On Okt 22 2019, Robert Pluim wrote:

> 'text-properties-at' is somewhat annoying to use interactively,

text-properties-at isn't a command.

> since it doesnʼt default to point.

If you want to add an interactive spec, it can just pass (point) by
default.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



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

* Re: default text-properties-at to use (point)
  2019-10-22  9:27 default text-properties-at to use (point) Robert Pluim
  2019-10-22  9:37 ` Andreas Schwab
@ 2019-10-22  9:39 ` Lars Ingebrigtsen
  2019-10-22  9:46   ` Andreas Schwab
  2019-10-22  9:50 ` Lars Ingebrigtsen
  2019-10-22 14:35 ` Eli Zaretskii
  3 siblings, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-22  9:39 UTC (permalink / raw)
  To: emacs-devel

Robert Pluim <rpluim@gmail.com> writes:

> 'text-properties-at' is somewhat annoying to use interactively, since
> it doesnʼt default to point. How about the following (plus appropriate
> doc/NEWS changes)?

Well, you can't use text-properties-at at all interactively now, I
think?  Or do you mean "interactively" as in M-: (text-properties-at)?

Actually, I think it'd be nice if text-properties-at did work
interactively, and just messaged what the properties were instead of
returning them...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* Re: default text-properties-at to use (point)
  2019-10-22  9:39 ` Lars Ingebrigtsen
@ 2019-10-22  9:46   ` Andreas Schwab
  2019-10-22 11:46     ` Robert Pluim
  2019-10-22 14:13     ` Lars Ingebrigtsen
  0 siblings, 2 replies; 15+ messages in thread
From: Andreas Schwab @ 2019-10-22  9:46 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

On Okt 22 2019, Lars Ingebrigtsen wrote:

> Actually, I think it'd be nice if text-properties-at did work
> interactively, and just messaged what the properties were instead of
> returning them...

What's wrong with describe-char?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



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

* Re: default text-properties-at to use (point)
  2019-10-22  9:27 default text-properties-at to use (point) Robert Pluim
  2019-10-22  9:37 ` Andreas Schwab
  2019-10-22  9:39 ` Lars Ingebrigtsen
@ 2019-10-22  9:50 ` Lars Ingebrigtsen
  2019-10-22 10:48   ` Dmitry Gutov
  2019-10-22 14:35 ` Eli Zaretskii
  3 siblings, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-22  9:50 UTC (permalink / raw)
  To: emacs-devel

Robert Pluim <rpluim@gmail.com> writes:

> 'text-properties-at' is somewhat annoying to use interactively, since
> it doesnʼt default to point. How about the following (plus appropriate
> doc/NEWS changes)?

Speaking of default values -- I think it'd be really nice if all the
huge number of functions that take beg/end ranges would default to
point-min/point-max.  Because I'm tired of typing in (foo-some-action
(point-min) (point-max)).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* Re: default text-properties-at to use (point)
  2019-10-22  9:50 ` Lars Ingebrigtsen
@ 2019-10-22 10:48   ` Dmitry Gutov
  0 siblings, 0 replies; 15+ messages in thread
From: Dmitry Gutov @ 2019-10-22 10:48 UTC (permalink / raw)
  To: emacs-devel

On 22.10.2019 12:50, Lars Ingebrigtsen wrote:
> Speaking of default values -- I think it'd be really nice if all the
> huge number of functions that take beg/end ranges would default to
> point-min/point-max.

Like buffer-substring and buffer-substring-no-properties.

Then we could obsolete buffer-string.



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

* Re: default text-properties-at to use (point)
  2019-10-22  9:46   ` Andreas Schwab
@ 2019-10-22 11:46     ` Robert Pluim
  2019-10-22 14:13     ` Lars Ingebrigtsen
  1 sibling, 0 replies; 15+ messages in thread
From: Robert Pluim @ 2019-10-22 11:46 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Lars Ingebrigtsen, emacs-devel

>>>>> On Tue, 22 Oct 2019 11:46:12 +0200, Andreas Schwab <schwab@suse.de> said:

    Andreas> On Okt 22 2019, Lars Ingebrigtsen wrote:
    >> Actually, I think it'd be nice if text-properties-at did work
    >> interactively, and just messaged what the properties were instead of
    >> returning them...

    Andreas> What's wrong with describe-char?

Itʼs far too verbose when all I want is the properties.

Robert



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

* Re: default text-properties-at to use (point)
  2019-10-22  9:37 ` Andreas Schwab
@ 2019-10-22 12:22   ` Robert Pluim
  0 siblings, 0 replies; 15+ messages in thread
From: Robert Pluim @ 2019-10-22 12:22 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

>>>>> On Tue, 22 Oct 2019 11:37:15 +0200, Andreas Schwab <schwab@suse.de> said:

    Andreas> On Okt 22 2019, Robert Pluim wrote:
    >> 'text-properties-at' is somewhat annoying to use interactively,

    Andreas> text-properties-at isn't a command.

True

    >> since it doesnʼt default to point.

    Andreas> If you want to add an interactive spec, it can just pass (point) by
    Andreas> default.

Thatʼs another option, I guess. But then itʼs a command, and Iʼd have
to change it to display the properties rather than return them.

Robert



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

* Re: default text-properties-at to use (point)
  2019-10-22  9:46   ` Andreas Schwab
  2019-10-22 11:46     ` Robert Pluim
@ 2019-10-22 14:13     ` Lars Ingebrigtsen
  2019-10-22 14:41       ` Andreas Schwab
  1 sibling, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-22 14:13 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

Andreas Schwab <schwab@suse.de> writes:

> What's wrong with describe-char?

That is indeed a pretty convenient way to look at text properties, if a
bit long-winded.  Which reminds me -- shouldn't it be bound to a key?
Under `C-h', probably?  

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* Re: default text-properties-at to use (point)
  2019-10-22  9:27 default text-properties-at to use (point) Robert Pluim
                   ` (2 preceding siblings ...)
  2019-10-22  9:50 ` Lars Ingebrigtsen
@ 2019-10-22 14:35 ` Eli Zaretskii
  2019-10-22 14:38   ` Robert Pluim
  3 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2019-10-22 14:35 UTC (permalink / raw)
  To: Robert Pluim; +Cc: emacs-devel

> From: Robert Pluim <rpluim@gmail.com>
> Gmane-Reply-To-List: yes
> Date: Tue, 22 Oct 2019 11:27:19 +0200
> 
> 'text-properties-at' is somewhat annoying to use interactively, since
> it doesnʼt default to point. How about the following (plus appropriate
> doc/NEWS changes)?

We already have describe-text-properties, which does default to point,
so why do we need another way of doing (a subset of) what it does?



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

* Re: default text-properties-at to use (point)
  2019-10-22 14:35 ` Eli Zaretskii
@ 2019-10-22 14:38   ` Robert Pluim
  2019-10-22 14:55     ` Lars Ingebrigtsen
                       ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Robert Pluim @ 2019-10-22 14:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

>>>>> On Tue, 22 Oct 2019 17:35:09 +0300, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Robert Pluim <rpluim@gmail.com>
    >> Gmane-Reply-To-List: yes
    >> Date: Tue, 22 Oct 2019 11:27:19 +0200
    >> 
    >> 'text-properties-at' is somewhat annoying to use interactively, since
    >> it doesnʼt default to point. How about the following (plus appropriate
    >> doc/NEWS changes)?

    Eli> We already have describe-text-properties, which does default to point,
    Eli> so why do we need another way of doing (a subset of) what it does?

We donʼt, now that I know about describe-text-properties (never let it
be said that emacs doesnʼt have enough functions).

Robert



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

* Re: default text-properties-at to use (point)
  2019-10-22 14:13     ` Lars Ingebrigtsen
@ 2019-10-22 14:41       ` Andreas Schwab
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Schwab @ 2019-10-22 14:41 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

On Okt 22 2019, Lars Ingebrigtsen wrote:

> Andreas Schwab <schwab@suse.de> writes:
>
>> What's wrong with describe-char?
>
> That is indeed a pretty convenient way to look at text properties, if a
> bit long-winded.  Which reminds me -- shouldn't it be bound to a key?
> Under `C-h', probably?  

You can get it via C-u C-x =.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



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

* Re: default text-properties-at to use (point)
  2019-10-22 14:38   ` Robert Pluim
@ 2019-10-22 14:55     ` Lars Ingebrigtsen
  2019-10-22 14:55     ` Lars Ingebrigtsen
  2019-10-22 16:02     ` Eli Zaretskii
  2 siblings, 0 replies; 15+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-22 14:55 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Eli Zaretskii, emacs-devel

Robert Pluim <rpluim@gmail.com> writes:

>>>>>> On Tue, 22 Oct 2019 17:35:09 +0300, Eli Zaretskii <eliz@gnu.org> said:
>
>     >> From: Robert Pluim <rpluim@gmail.com>
>     >> Gmane-Reply-To-List: yes
>     >> Date: Tue, 22 Oct 2019 11:27:19 +0200
>     >> 
>     >> 'text-properties-at' is somewhat annoying to use interactively, since
>     >> it doesnʼt default to point. How about the following (plus appropriate
>     >> doc/NEWS changes)?
>
>     Eli> We already have describe-text-properties, which does default to point,
>     Eli> so why do we need another way of doing (a subset of) what it does?
>
> We donʼt, now that I know about describe-text-properties (never let it
> be said that emacs doesnʼt have enough functions).
>
> Robert

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* Re: default text-properties-at to use (point)
  2019-10-22 14:38   ` Robert Pluim
  2019-10-22 14:55     ` Lars Ingebrigtsen
@ 2019-10-22 14:55     ` Lars Ingebrigtsen
  2019-10-22 16:02     ` Eli Zaretskii
  2 siblings, 0 replies; 15+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-22 14:55 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Eli Zaretskii, emacs-devel

Robert Pluim <rpluim@gmail.com> writes:

>     Eli> We already have describe-text-properties, which does default to point,
>     Eli> so why do we need another way of doing (a subset of) what it does?
>
> We donʼt, now that I know about describe-text-properties (never let it
> be said that emacs doesnʼt have enough functions).

I didn't know about that command, either, so I've now made the
text-properties-at doc string mention it.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* Re: default text-properties-at to use (point)
  2019-10-22 14:38   ` Robert Pluim
  2019-10-22 14:55     ` Lars Ingebrigtsen
  2019-10-22 14:55     ` Lars Ingebrigtsen
@ 2019-10-22 16:02     ` Eli Zaretskii
  2 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2019-10-22 16:02 UTC (permalink / raw)
  To: Robert Pluim; +Cc: emacs-devel

> From: Robert Pluim <rpluim@gmail.com>
> Date: Tue, 22 Oct 2019 16:38:49 +0200
> Cc: emacs-devel@gnu.org
> 
>     Eli> We already have describe-text-properties, which does default to point,
>     Eli> so why do we need another way of doing (a subset of) what it does?
> 
> We donʼt, now that I know about describe-text-properties (never let it
> be said that emacs doesnʼt have enough functions).

Ah, okay ;-)

I use that command all the time, btw.



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

end of thread, other threads:[~2019-10-22 16:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-22  9:27 default text-properties-at to use (point) Robert Pluim
2019-10-22  9:37 ` Andreas Schwab
2019-10-22 12:22   ` Robert Pluim
2019-10-22  9:39 ` Lars Ingebrigtsen
2019-10-22  9:46   ` Andreas Schwab
2019-10-22 11:46     ` Robert Pluim
2019-10-22 14:13     ` Lars Ingebrigtsen
2019-10-22 14:41       ` Andreas Schwab
2019-10-22  9:50 ` Lars Ingebrigtsen
2019-10-22 10:48   ` Dmitry Gutov
2019-10-22 14:35 ` Eli Zaretskii
2019-10-22 14:38   ` Robert Pluim
2019-10-22 14:55     ` Lars Ingebrigtsen
2019-10-22 14:55     ` Lars Ingebrigtsen
2019-10-22 16:02     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).