all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual
Date: Mon, 04 Jun 2018 19:17:16 +0200	[thread overview]
Message-ID: <87zi0a5v4z.fsf@gmail.com> (raw)
In-Reply-To: <8336y2czrp.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 04 Jun 2018 18:55:22 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Robert Pluim <rpluim@gmail.com>
>> Cc: emacs-devel@gnu.org
>> Date: Mon, 04 Jun 2018 11:41:24 +0200
>> 
>> +   ;; beginning of sentence
>> +   ((looking-back "  ")
>> +    "@xref{")
>
> This misses the beginning of a sentence after a newline, right?

Hmm. (looking-back (sentence-end)) perhaps? Or if thatʼs overkill
"\\(?:  \\|\\.\n\\)"

(I did wonder why thereʼs no (sentence-beginning))

>> +   ;; bol or eol
>> +   ((looking-at "^\\|$")
>> +    "@ref{")
>> +   ;; inside word
>> +   ((not (eq (char-syntax (char-after)) ? ))
>> +    (skip-syntax-backward "^ ")
>> +    "@ref{")
>> +   ;; everything else
>> +   (t
>> +    "@ref{"))
>> +  _ "}")
>
> Why did you need the first 2 cases that yield @ref?

If I have text like this:

word one
word two
 ^

with point where the ^ is, then we need to skip backwards until we
reach whitespace, otherwise we insert the ref in the middle of a word.

If we have this:

word one
word two
^

Then we donʼt want to skip backwards, since we'll end up before 'one',
hence we need to check for bol first. Similar reasoning applies for
eol.

I strongly suspect you'll now either ask for this to be explained in
the code and the docstring, or show me a single line of code that
achieves the same effect, thus providing me with another Emacs 'Aha!'
moment.

> This will need a NEWS entry.

Of course. Something like this, which will also go in the doc string.

** Texinfo
*** New function for inserting @pxref, @xref, or @ref commands
The function 'texinfo-insert-dwim-@ref', bound to 'C-c C-c r' by
default, inserts one of the three types of references based on the text
surrounding point, namely @pxref after a parenthesis, @xref at the
start of a sentence, else @ref.

Regards

Robert



  reply	other threads:[~2018-06-04 17:17 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29  7:33 bug#31636: 27.0.50; lockfile syntax searchable from info manual Brady Trainor
2018-05-29  8:40 ` Robert Pluim
2018-05-29 11:24   ` Noam Postavsky
2018-05-29 13:17     ` Robert Pluim
2018-05-29 16:46       ` Eli Zaretskii
2018-05-29 19:06         ` Robert Pluim
2018-05-30  2:42           ` Eli Zaretskii
2018-05-31 10:29             ` Robert Pluim
2018-06-01  8:52               ` Eli Zaretskii
2018-06-01 10:47                 ` Robert Pluim
2018-06-01 13:00                   ` Eli Zaretskii
2018-06-01 13:24                     ` Robert Pluim
2018-06-01 13:25                     ` Robert Pluim
2018-06-01 13:42                       ` Robert Pluim
2018-06-04  9:41                         ` Robert Pluim
2018-06-04 10:39                           ` Andreas Schwab
2018-06-04 14:02                             ` Robert Pluim
2018-06-04 16:06                               ` Eli Zaretskii
2018-06-04 15:55                           ` Eli Zaretskii
2018-06-04 17:17                             ` Robert Pluim [this message]
2018-06-05 15:07                               ` Eli Zaretskii
2018-06-05 19:51                                 ` Robert Pluim
2018-06-05 20:08                                   ` Noam Postavsky
2018-06-06  7:43                                     ` Robert Pluim
2018-06-06 13:13                                       ` Noam Postavsky
2018-06-06 13:51                                         ` Robert Pluim
2018-06-06 14:41                                           ` Noam Postavsky
2018-06-06 14:51                                             ` Robert Pluim
2018-05-29 19:20         ` Paul Eggert
2018-05-30  2:42           ` 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

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

  git send-email \
    --in-reply-to=87zi0a5v4z.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=eliz@gnu.org \
    --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 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.