[Top][All Lists]

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

Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual

From: Robert Pluim
Subject: Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual
Date: Mon, 04 Jun 2018 19:17:16 +0200

Eli Zaretskii <address@hidden> writes:

>> From: Robert Pluim <address@hidden>
>> Cc: address@hidden
>> 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

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!'

> 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 'address@hidden', 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.



reply via email to

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