* Re: [Emacs-diffs] master 6827370: Skip past `#' to find BEG
2015-06-09 7:03 ` Dmitry Gutov
@ 2015-06-09 9:25 ` Nicolas Richard
2015-06-10 21:45 ` Dmitry Gutov
2015-06-09 16:05 ` Stefan Monnier
2015-06-09 16:07 ` Stefan Monnier
2 siblings, 1 reply; 11+ messages in thread
From: Nicolas Richard @ 2015-06-09 9:25 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: Stefan Monnier, emacs-devel
Dmitry Gutov <dgutov@yandex.ru> writes:
> By the way, what is that 'p' syntax class mentioned in the
> backward-prefix-chars docstring?
I think it's not a syntax class, but a flag as described here :
(info "(elisp) Syntax Flags")
--8<---------------cut here---------------start------------->8---
* `p' identifies an additional "prefix character" for Lisp syntax.
These characters are treated as whitespace when they appear between
expressions. When they appear within an expression, they are
handled according to their usual syntax classes.
The function `backward-prefix-chars' moves back over these
characters, as well as over characters whose primary syntax class
is prefix (`''). *Note Motion and Syntax::.
--8<---------------cut here---------------end--------------->8---
I could suggest :
--8<---------------cut here---------------start------------->8---
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3013,7 +3013,7 @@ but before count is used up, nil is returned. */)
DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars,
0, 0, 0,
doc: /* Move point backward over any number of chars with prefix syntax.
-This includes chars with "quote" or "prefix" syntax (' or p). */)
+This includes chars with "quote" syntax class (') or "prefix" syntax flag (p). */)
(void)
{
ptrdiff_t beg = BEGV;
--8<---------------cut here---------------end--------------->8---
Is it any better ?
--
Nico.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Emacs-diffs] master 6827370: Skip past `#' to find BEG
2015-06-09 9:25 ` Nicolas Richard
@ 2015-06-10 21:45 ` Dmitry Gutov
2015-06-11 9:50 ` Nicolas Richard
0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Gutov @ 2015-06-10 21:45 UTC (permalink / raw)
To: Nicolas Richard; +Cc: Stefan Monnier, emacs-devel
On 06/09/2015 12:25 PM, Nicolas Richard wrote:
> I could suggest :
> --8<---------------cut here---------------start------------->8---
> --- a/src/syntax.c
> +++ b/src/syntax.c
> @@ -3013,7 +3013,7 @@ but before count is used up, nil is returned. */)
> DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars,
> 0, 0, 0,
> doc: /* Move point backward over any number of chars with prefix syntax.
> -This includes chars with "quote" or "prefix" syntax (' or p). */)
> +This includes chars with "quote" syntax class (') or "prefix" syntax flag (p). */)
> (void)
> {
> ptrdiff_t beg = BEGV;
> --8<---------------cut here---------------end--------------->8---
>
> Is it any better ?
It is, thanks. Makes one contemplate why we have two different
descriptions of the same function, and how easily they can get out of sync.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Emacs-diffs] master 6827370: Skip past `#' to find BEG
2015-06-10 21:45 ` Dmitry Gutov
@ 2015-06-11 9:50 ` Nicolas Richard
0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Richard @ 2015-06-11 9:50 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: Stefan Monnier, emacs-devel
Dmitry Gutov <dgutov@yandex.ru> writes:
> It is, thanks. Makes one contemplate why we have two different
> descriptions of the same function, and how easily they can get out of
> sync.
Speaking of which, the manual uses "expression prefix" instead of
"quote". I'll use that in the docstring too, for consistency. Pushed as
ece5691.
--
Nico
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Emacs-diffs] master 6827370: Skip past `#' to find BEG
2015-06-09 7:03 ` Dmitry Gutov
2015-06-09 9:25 ` Nicolas Richard
@ 2015-06-09 16:05 ` Stefan Monnier
2015-06-09 16:33 ` Dmitry Gutov
2015-06-09 16:07 ` Stefan Monnier
2 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2015-06-09 16:05 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: emacs-devel
> By the way, what is that 'p' syntax class mentioned in the
> backward-prefix-chars docstring?
In text mode, for example, the single quote has syntax "w p", which
means that it's half-way between a word constituent and a prefix char.
More specifically, when at the beginning/end of a word, it's not
considered as part of the word, but it can appear in the middle of
a word.
This makes capitalize work correctly for things like:
i can't believe he said 'hello' !
-- Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Emacs-diffs] master 6827370: Skip past `#' to find BEG
2015-06-09 16:05 ` Stefan Monnier
@ 2015-06-09 16:33 ` Dmitry Gutov
0 siblings, 0 replies; 11+ messages in thread
From: Dmitry Gutov @ 2015-06-09 16:33 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
On 06/09/2015 07:05 PM, Stefan Monnier wrote:
> In text mode, for example, the single quote has syntax "w p", which
> means that it's half-way between a word constituent and a prefix char.
> More specifically, when at the beginning/end of a word, it's not
> considered as part of the word, but it can appear in the middle of
> a word.
> This makes capitalize work correctly for things like:
>
> i can't believe he said 'hello' !
Thanks. Looking at it now, maybe the same use case could've been better
served by a syntax-propertize-function.
Regarding a backward-prefix-chars counterpart, maybe
skip-syntax-forward/backward could be taught to read modifiers from its
first argument as well.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Emacs-diffs] master 6827370: Skip past `#' to find BEG
2015-06-09 7:03 ` Dmitry Gutov
2015-06-09 9:25 ` Nicolas Richard
2015-06-09 16:05 ` Stefan Monnier
@ 2015-06-09 16:07 ` Stefan Monnier
2015-06-09 16:28 ` Dmitry Gutov
2 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2015-06-09 16:07 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: emacs-devel
>>> - (skip-chars-forward "`',‘")
>>> + (skip-chars-forward "`',‘#")
>> Should we use something like backward-prefix-chars (but going forward)?
> You mean (skip-syntax-forward "'")?
Something like that, yes.
> For the moment, this would exclude the curly quotes, at least (which
> would be fine by me, since I don't want to see them in the source
> code, and would be happy to revert that part of
> 0fd5e6593af620863dcf90dff5d04631458e24cd).
I think this is useful for completion inside docstrings.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread