unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master 6827370: Skip past `#' to find BEG
       [not found] ` <E1Z25Dp-0002eB-Tw@vcs.savannah.gnu.org>
@ 2015-06-08 23:57   ` Stefan Monnier
  2015-06-09  7:03     ` Dmitry Gutov
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2015-06-08 23:57 UTC (permalink / raw)
  To: emacs-devel; +Cc: Dmitry Gutov

> -		      (skip-chars-forward "`',‘")
> +		      (skip-chars-forward "`',‘#")

Should we use something like backward-prefix-chars (but going forward)?


        Stefan



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

* Re: [Emacs-diffs] master 6827370: Skip past `#' to find BEG
  2015-06-08 23:57   ` [Emacs-diffs] master 6827370: Skip past `#' to find BEG Stefan Monnier
@ 2015-06-09  7:03     ` Dmitry Gutov
  2015-06-09  9:25       ` Nicolas Richard
                         ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Dmitry Gutov @ 2015-06-09  7:03 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

On 06/09/2015 02:57 AM, Stefan Monnier wrote:
>> -		      (skip-chars-forward "`',‘")
>> +		      (skip-chars-forward "`',‘#")
>
> Should we use something like backward-prefix-chars (but going forward)?

You mean (skip-syntax-forward "'")? 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).

By the way, what is that 'p' syntax class mentioned in the 
backward-prefix-chars docstring?



^ 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-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  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  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

* Re: [Emacs-diffs] master 6827370: Skip past `#' to find BEG
  2015-06-09 16:07       ` Stefan Monnier
@ 2015-06-09 16:28         ` Dmitry Gutov
  2015-06-09 18:06           ` Paul Eggert
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Gutov @ 2015-06-09 16:28 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On 06/09/2015 07:07 PM, Stefan Monnier wrote:

> I think this is useful for completion inside docstrings.

Only if the docstring's source contains the curly quotes directly, as 
markup for symbol references. Which is something we've successfully 
avoided until now.



^ 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 16:28         ` Dmitry Gutov
@ 2015-06-09 18:06           ` Paul Eggert
  2015-06-09 18:17             ` Dmitry Gutov
  0 siblings, 1 reply; 11+ messages in thread
From: Paul Eggert @ 2015-06-09 18:06 UTC (permalink / raw)
  To: emacs-devel

On 06/09/2015 09:28 AM, Dmitry Gutov wrote:
>
> Only if the docstring's source contains the curly quotes directly, as 
> markup for symbol references.

The intent is to allow and encourage docstrings that use curly quotes, 
so that they are more WYSIWYG.



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

* Re: [Emacs-diffs] master 6827370: Skip past `#' to find BEG
  2015-06-09 18:06           ` Paul Eggert
@ 2015-06-09 18:17             ` Dmitry Gutov
  0 siblings, 0 replies; 11+ messages in thread
From: Dmitry Gutov @ 2015-06-09 18:17 UTC (permalink / raw)
  To: Paul Eggert, emacs-devel

On 06/09/2015 09:06 PM, Paul Eggert wrote:

> The intent is to allow and encourage docstrings that use curly quotes,
> so that they are more WYSIWYG.

Indeed. I'm still not convinced. But Stefan seems to like that idea, so...



^ 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

end of thread, other threads:[~2015-06-11  9:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20150608220845.10141.75038@vcs.savannah.gnu.org>
     [not found] ` <E1Z25Dp-0002eB-Tw@vcs.savannah.gnu.org>
2015-06-08 23:57   ` [Emacs-diffs] master 6827370: Skip past `#' to find BEG Stefan Monnier
2015-06-09  7:03     ` Dmitry Gutov
2015-06-09  9:25       ` Nicolas Richard
2015-06-10 21:45         ` Dmitry Gutov
2015-06-11  9:50           ` Nicolas Richard
2015-06-09 16:05       ` Stefan Monnier
2015-06-09 16:33         ` Dmitry Gutov
2015-06-09 16:07       ` Stefan Monnier
2015-06-09 16:28         ` Dmitry Gutov
2015-06-09 18:06           ` Paul Eggert
2015-06-09 18:17             ` Dmitry Gutov

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).