all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lennart Borgman <lennart.borgman@gmail.com>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: C Mode: acceleration in brace deserts.
Date: Fri, 4 Dec 2009 13:18:25 +0100	[thread overview]
Message-ID: <e01d8a50912040418w6358cff7y861dfbea30df720b@mail.gmail.com> (raw)
In-Reply-To: <e01d8a50912040403i2c6d264y4c0b9a5cd2c1cac6@mail.gmail.com>

On Fri, Dec 4, 2009 at 1:03 PM, Lennart Borgman
<lennart.borgman@gmail.com> wrote:
> On Fri, Dec 4, 2009 at 12:56 PM, Alan Mackenzie <acm@muc.de> wrote:
>> On Fri, Dec 04, 2009 at 12:03:27PM +0100, Lennart Borgman wrote:
>>> On Fri, Dec 4, 2009 at 11:34 AM, Lennart Borgman
>>
>>> Just a question I forgot: Why are you not using syntax-ppss here
>>> [keeping track of comments/strings in c-parse-state's supporting
>>> functions]?  Are you not looking for the same thing (ie inside comment
>>> or string).
>>
>> I think at the time I did it, it was just less work to write it from
>> scratch.  syntax-ppss isn't a well encapsulated system, and it almost
>> requires its users to read its source code to see exactly what it does.
>> Also, c-parse-state (in effect) changes the syntax table in use by
>> setting category properties.  At the time, I was considering actually
>> changing the syntax table (for reasons I'm not entirely clear about any
>> more).  Does syntax-ppss exist in XEmacs, and if so, since when?  Some of
>> syntax-ppss's supporting infrastructure only came into existence after
>> syntax-ppss itself.
>>
>>> If you did it that way then it would already be supported by MuMaMo.
>>
>> Ah.  That sounds like a good reason to change my new code to use
>> syntax-ppss.  :-(  But not before the first pretest release next week.
>
> Thanks. ;-)
>
> Would it be enough to change c-state-literal-at? Perhaps you could
> send me a new version of that so I could test it in that case. I could
> just defadvice c-state-literal-at.

Just to show how little I understand of this: Would this do the
c-state-literal-at ob?

(defun mumamo-c-state-literal-at (here)
  ;; If position HERE is inside a literal, return (START . END), the
  ;; boundaries of the literal (which may be outside the accessible bit of the
  ;; buffer).  Otherwise, return nil.
  ;;
  ;; This function is almost the same as `c-literal-limits'.  It differs in
  ;; that it is a lower level function, and that it rigourously follows the
  ;; syntax from BOB, whereas `c-literal-limits' uses a "local" safe position.
  (let* ((is-here (point))
         (s (syntax-ppss here))
         (ret (when (or (nth 3 s) (nth 4 s))	; in a string or comment
                (parse-partial-sexp (point) (point-max)
                                    nil			 ; TARGETDEPTH
                                    nil			 ; STOPBEFORE
                                    s			 ; OLDSTATE
                                    'syntax-table)	 ; stop at end of literal
                (cons (nth 8 s) (point)))))
    (goto-char is-here)
    ret))




  reply	other threads:[~2009-12-04 12:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03 16:21 C Mode: acceleration in brace deserts Alan Mackenzie
2009-12-03 16:26 ` Lennart Borgman
2009-12-03 16:59   ` Alan Mackenzie
2009-12-03 17:22     ` Lennart Borgman
2009-12-03 19:39       ` Alan Mackenzie
2009-12-03 19:57         ` Lennart Borgman
2009-12-04 10:34           ` Lennart Borgman
2009-12-04 11:03             ` Lennart Borgman
2009-12-04 11:56               ` Alan Mackenzie
2009-12-04 12:03                 ` Lennart Borgman
2009-12-04 12:18                   ` Lennart Borgman [this message]
2009-12-04 13:54             ` Alan Mackenzie
2009-12-04 19:03               ` Lennart Borgman
2009-12-05  2:11                 ` Lennart Borgman
2009-12-05  4:49                   ` Stefan Monnier
2009-12-04  5:31     ` Richard Stallman
2009-12-04 11:37       ` Alan Mackenzie
2009-12-05  6:50         ` Richard Stallman
2009-12-03 17:09 ` Stefan Monnier

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=e01d8a50912040418w6358cff7y861dfbea30df720b@mail.gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=acm@muc.de \
    --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.