unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: emacs-devel@gnu.org
Subject: default text-properties-at to use (point)
Date: Tue, 22 Oct 2019 11:27:19 +0200	[thread overview]
Message-ID: <m2tv819ll4.fsf@gmail.com> (raw)

'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);
 



             reply	other threads:[~2019-10-22  9:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22  9:27 Robert Pluim [this message]
2019-10-22  9:37 ` default text-properties-at to use (point) 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

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2tv819ll4.fsf@gmail.com \
    --to=rpluim@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 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).