all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* parens matching not matching all matching parens
@ 2004-09-16 19:19 Arjan Bos
  2004-09-16 19:42 ` J. David Boyd
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Arjan Bos @ 2004-09-16 19:19 UTC (permalink / raw)


Hi all,

I'm currently developing yet another rich text format writer. And as you 
might know, RTF is using curly braces a lot. Alas, every now and then, a 
normal parentheses pops up between a set of matching {}. Both the parens 
matching colouring and the forward-sexp / backward-sexp can't handle 
this. How can I (help to) solve this?

An rtf snippet is included here:

{\rtf1\mac\ansicpg10000\uc1
{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}}

This is a complete piece of (non-sensical, but correct) rtf. The first 
`{' matches the last `}'. Only C-M-f jumps from the first `{' to the 
one-to-last `}'.

I'm wondering if this is a bug or not.

TIA,

Arjan


-- 
--
If you really want to contact me, then replace the "I see you" text by 
its three letter accronym, hetnet.

Fabricate Diem PVNC, Motto of the Night Watch -- Terry Pratchett

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

* Re: parens matching not matching all matching parens
  2004-09-16 19:19 parens matching not matching all matching parens Arjan Bos
@ 2004-09-16 19:42 ` J. David Boyd
       [not found] ` <mailman.3032.1095364141.1998.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: J. David Boyd @ 2004-09-16 19:42 UTC (permalink / raw)


Arjan Bos <Arjan.Bos@nospam.ISeeYou.nl> writes:

> {\rtf1\mac\ansicpg10000\uc1
> {\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}}
> 
> This is a complete piece of (non-sensical, but correct) rtf. The first
> `{' matches the last `}'. Only C-M-f jumps from the first `{' to the
> one-to-last `}'.
> 

I see three opening, and four closing curly braces.  Aren't they
supposed to be even?

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

* Re: parens matching not matching all matching parens
       [not found] ` <mailman.3032.1095364141.1998.help-gnu-emacs@gnu.org>
@ 2004-09-16 20:19   ` Arjan Bos
  2004-09-16 21:45     ` Miles Bader
  0 siblings, 1 reply; 12+ messages in thread
From: Arjan Bos @ 2004-09-16 20:19 UTC (permalink / raw)


J. David Boyd wrote:

> Arjan Bos <Arjan.Bos@nospam.ISeeYou.nl> writes:
> 
> 
>>{\rtf1\mac\ansicpg10000\uc1
>>{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}}
>>
>>This is a complete piece of (non-sensical, but correct) rtf. The first
>>`{' matches the last `}'. Only C-M-f jumps from the first `{' to the
>>one-to-last `}'.
>>
> 
> 
> I see three opening, and four closing curly braces.  Aren't they
> supposed to be even?
> 
They are supposed to be even, yes, and they are. That is the problem. In 
sequence, there are three opening `{', one closing ')' and three closing 
'}'. It is very easy for a human to get confused, so I expect(ed) a 
little help from emacs. ;-)

Arjan

-- 
--
If you really want to contact me, then replace the "I see you" text by 
its three letter accronym, ICU.

Fabricate Diem PVNC, Motto of the Night Watch -- Terry Pratchett

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

* Re: parens matching not matching all matching parens
  2004-09-16 20:19   ` Arjan Bos
@ 2004-09-16 21:45     ` Miles Bader
  2004-09-17 17:25       ` Arjan Bos
  0 siblings, 1 reply; 12+ messages in thread
From: Miles Bader @ 2004-09-16 21:45 UTC (permalink / raw)


Arjan Bos <Arjan.Bos@nospam.ISeeYou.nl> writes:
> They are supposed to be even, yes, and they are. That is the problem. In
> sequence, there are three opening `{', one closing ')' and three closing
> }'. It is very easy for a human to get confused, so I expect(ed) a
> little help from emacs. ;-)

Perhaps you want to remove the parenthes-syntax of "(" and ")" (and
maybe brackets too), so that only braces will ever participate in
matching, e.g.:

   (defvar my-wacky-syntax-table
     (let ((table (make-syntax-table)))
       (modify-syntax-entry ?( "." table)
       (modify-syntax-entry ?) "." table)
       (modify-syntax-entry ?[ "." table)
       (modify-syntax-entry ?] "." table)
       table))

   ;; ... later, in mode init function:
   (set-syntax-table my-wacky-syntax-table)

-Miles
-- 
80% of success is just showing up.  --Woody Allen

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

* Re: parens matching not matching all matching parens
  2004-09-16 19:19 parens matching not matching all matching parens Arjan Bos
  2004-09-16 19:42 ` J. David Boyd
       [not found] ` <mailman.3032.1095364141.1998.help-gnu-emacs@gnu.org>
@ 2004-09-17  2:18 ` Greg Hill
       [not found] ` <mailman.3063.1095387904.1998.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 12+ messages in thread
From: Greg Hill @ 2004-09-17  2:18 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 3772 bytes --]

At 9:19 PM +0200 9/16/04, Arjan Bos wrote:
>Hi all,
>
>I'm currently developing yet another rich text format writer. And as 
>you might know, RTF is using curly braces a lot. Alas, every now and 
>then, a normal parentheses pops up between a set of matching {}. 
>Both the parens matching colouring and the forward-sexp / 
>backward-sexp can't handle this. How can I (help to) solve this?
>
>An rtf snippet is included here:
>
>{\rtf1\mac\ansicpg10000\uc1
>{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}}
>
>This is a complete piece of (non-sensical, but correct) rtf. The 
>first `{' matches the last `}'. Only C-M-f jumps from the first `{' 
>to the one-to-last `}'.
>
>I'm wondering if this is a bug or not.
>
>TIA,
>
>Arjan

Arjan,

Personally, I would call it a bug in the 'scan-sexps built-in 
function, which is called by 'forward-sexp, which is normally bound 
to "C-M-f".  For some reason 'scan-sexps seems to treat a ")" as 
matching a "{".  You might want to submit a bug report, but there is 
no guanentee the maintainers of Emacs will not call that odd behavior 
a "feature."

On the other hand, if you just want to get on with life, you can try 
putting something like the following code in your .emacs file.  The 
'defun defines a function that scans forward for the first '(', '[', 
'<' or '{' following point, whatever it see first, then scans for a 
matching closing character, ignoring any other characters.  The 
'(setq forward-sexp-function... effectively replaces the guts of 
'forward-sexp with the new function, so you will not have to rebind 
your keystroke.  It works in the backward direction as well ("C-M-b").

(defun forward-pexp (&optional arg)
   (interactive "p")
   (or arg (setq arg 1))
   (let (open close next notstrc notstro notstre depth)
     (catch 'done
       (cond ((> arg 0)
	     (skip-chars-forward "^([{<")
	     (setq open (char-after))
	     (cond ((eq open ?\()
		    (setq close ?\)))
		   ((eq open ?\[)
		    (setq close ?\]))
		   ((eq open ?\{)
		    (setq close ?\}))
		   ((eq open ?\<)
		    (setq close ?\>))
		   (t
		    (throw 'done nil) ) )
	     (setq notstro (concat "^" (char-to-string open))
		   notstre (concat notstro (char-to-string close)) )
	     (while (and (> arg 0) (not (eobp)))
	       (skip-chars-forward notstro)
	       (forward-char 1)
	       (setq depth 1)
	       (while (and (> depth 0) (not (eobp)))
		 (skip-chars-forward notstre)
		 (setq next (char-after))
		 (cond ((eq next open)
			(setq depth (1+ depth)) )
		       ((eq next close)
			(setq depth (1- depth)) )
		       (t
			(throw 'done nil) ) )
		 (forward-char 1) )
	       (setq arg (1- arg) ) ) )
	    ((< arg 0)
	     (skip-chars-backward "^)]}>")
	     (setq close (char-before))
	     (cond ((eq close ?\))
		    (setq open ?\())
		   ((eq close ?\])
		    (setq open ?\[))
		   ((eq close ?\})
		    (setq open ?\{))
		   ((eq close ?\>)
		    (setq open ?\<))
		   (t
		    (throw 'done nil) ) )
	     (setq notstrc (concat "^" (char-to-string close))
		   notstre (concat notstrc (char-to-string open)) )
	     (while (and (< arg 0) (not (bobp)))
	       (skip-chars-backward notstrc)
	       (forward-char -1)
	       (setq depth 1)
	       (while (and (> depth 0) (not (bobp)))
		 (skip-chars-backward notstre)
		 (setq next (char-before))
		 (cond ((eq next close)
			(setq depth (1+ depth)) )
		       ((eq next open)
			(setq depth (1- depth)) )
		       (t
			(throw 'done nil) ) )
		 (forward-char -1) )
	       (setq arg (1+ arg)) ) )	) ) ))

(setq forward-sexp-function 'forward-pexp)

I should warn you, by the way, that I just hacked this code together 
in a few minutes after work tonight, and have not tested it 
exhuastively.  Let me know if you have any questions or problems.

--Greg

[-- Attachment #1.2: Type: text/html, Size: 14063 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: parens matching not matching all matching parens
  2004-09-16 21:45     ` Miles Bader
@ 2004-09-17 17:25       ` Arjan Bos
  2004-09-17 18:17         ` Stefan Monnier
  2004-09-17 18:22         ` Stefan Monnier
  0 siblings, 2 replies; 12+ messages in thread
From: Arjan Bos @ 2004-09-17 17:25 UTC (permalink / raw)


Miles Bader wrote:

> 
> Perhaps you want to remove the parenthes-syntax of "(" and ")" (and
> maybe brackets too), so that only braces will ever participate in
> matching, e.g.:
> 
>    (defvar my-wacky-syntax-table
>      (let ((table (make-syntax-table)))
>        (modify-syntax-entry ?( "." table)
>        (modify-syntax-entry ?) "." table)
>        (modify-syntax-entry ?[ "." table)
>        (modify-syntax-entry ?] "." table)
>        table))
> 
>    ;; ... later, in mode init function:
>    (set-syntax-table my-wacky-syntax-table)
> 
> -Miles

Miles,

Sounds like a plan. Do you have any idea as to how I can integrate that 
in the generic-mode setup I have currently?

This is what I have:

;; rtf-mode
(define-generic-mode 'rtf-generic-mode
   nil
   nil
   (list "\\\\\\([a-z]+\\(-?[0-9]+\\)? ?\\)")
   (list "\\.[rR][tT][fF]")
   nil)

So I should call some function in the last `nil' I presume. Is it 
possible to combine the (defvar my-wacky-syntax-table ...) with the 
(set-syntax-table ... )?


Thanks In Advance,

Arjan

--
If you really want to contact me, then replace the "I see you" text by 
its three letter accronym, hetnet.

Fabricate Diem PVNC, Motto of the Night Watch -- Terry Pratchett

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

* Re: parens matching not matching all matching parens
       [not found] ` <mailman.3063.1095387904.1998.help-gnu-emacs@gnu.org>
@ 2004-09-17 17:29   ` Arjan Bos
  2004-09-17 20:43     ` Greg Hill
  0 siblings, 1 reply; 12+ messages in thread
From: Arjan Bos @ 2004-09-17 17:29 UTC (permalink / raw)


Greg Hill wrote:

> At 9:19 PM +0200 9/16/04, Arjan Bos wrote:
> 
>> Hi all,
>>
>> I'm currently developing yet another rich text format writer. And as 
>> you might know, RTF is using curly braces a lot. Alas, every now and 
>> then, a normal parentheses pops up between a set of matching {}. Both 
>> the parens matching colouring and the forward-sexp / backward-sexp 
>> can't handle this. How can I (help to) solve this?
>>
>> An rtf snippet is included here:
> 
>> {\rtf1\mac\ansicpg10000\uc1
>> {\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}}
> 
>>
>> This is a complete piece of (non-sensical, but correct) rtf. The first 
>> `{' matches the last `}'. Only C-M-f jumps from the first `{' to the 
>> one-to-last `}'.
> 
>>
>> I'm wondering if this is a bug or not.
>>
>> TIA,
> 
>> Arjan
> 
> 
> Arjan,
> 
> Personally, I would call it a bug in the 'scan-sexps built-in function, 
> which is called by 'forward-sexp, which is normally bound to "C-M-f".  
> For some reason 'scan-sexps seems to treat a ")" as matching a "{".  You 
> might want to submit a bug report, but there is no guanentee the 
> maintainers of Emacs will not call that odd behavior a "feature."

Thanks,
I'll submit a bug.

> 
> On the other hand, if you just want to get on with life, you can try 
> putting something like the following code in your .emacs file.  The 
> 'defun defines a function that scans forward for the first '(', '[', '<' 
> or '{' following point, whatever it see first, then scans for a matching 
> closing character, ignoring any other characters.  The '(setq 
> forward-sexp-function... effectively replaces the guts of 'forward-sexp 
> with the new function, so you will not have to rebind your keystroke.  
> It works in the backward direction as well ("C-M-b").
> 
<snip gone="code"/>


> I should warn you, by the way, that I just hacked this code together in 
> a few minutes after work tonight, and have not tested it exhuastively.  
> Let me know if you have any questions or problems.

Greg,

I already had something similar. Looking at the current bracket under 
point, finding its opposite and start counting the brackets you 
encounter. Another of the same bracket ups the ante, the opposite pops 
one from the ante. When the ante is empty, all bets are off, and the 
bracket is found.

My code isn't perfect, so I will borrow heavily from yours.

Thanks!
> 
> --Greg


-- 
--
If you really want to contact me, then replace the "I see you" text by 
its three letter accronym, ICU.

Fabricate Diem PVNC, Motto of the Night Watch -- Terry Pratchett

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

* Re: parens matching not matching all matching parens
  2004-09-17 17:25       ` Arjan Bos
@ 2004-09-17 18:17         ` Stefan Monnier
  2004-09-18  0:25           ` Miles Bader
  2004-09-17 18:22         ` Stefan Monnier
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2004-09-17 18:17 UTC (permalink / raw)


> Sounds like a plan. Do you have any idea as to how I can integrate that in
> the generic-mode setup I have currently?

The generic-mode stuff is fine for very very simple stuff, but nothing else.
And sadly it doesn't naturally extend from one step to the other.
So I'd recommend you google for sample-mode.el and start from there.


        Stefan

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

* Re: parens matching not matching all matching parens
  2004-09-17 17:25       ` Arjan Bos
  2004-09-17 18:17         ` Stefan Monnier
@ 2004-09-17 18:22         ` Stefan Monnier
  2004-09-17 18:36           ` Arjan Bos
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2004-09-17 18:22 UTC (permalink / raw)


> (define-generic-mode 'rtf-generic-mode
>    nil
>    nil
>    (list "\\\\\\([a-z]+\\(-?[0-9]+\\)? ?\\)")
>    (list "\\.[rR][tT][fF]")
>    nil)

Try

(defvar rtf-font-lock-keywords
  '("\\\\\\([a-z]+\\(-?[0-9]+\\)? ?\\)"))

(defvar rtf-mode-syntax-table
  (let ((st (make-syntax-table)))
    (modify-syntax-entry ?\( "." st)
    (modify-syntax-entry ?\) "." st)
    (modify-syntax-entry ?\[ "." st)
    (modify-syntax-entry ?\] "." st)
    st))

;;;###autoload
(add-to-list 'auto-mode-alist '("\\.[rR][tT][fF]\\'" . rtf-mode))

(define-derived-mode rtf-mode text-mode "RTF"
  "Major mode for Rich Text Format."
  (set (make-local-variable 'font-lock-defaults)
       '(rtf-font-lock-keywords)))


-- Stefan

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

* Re: parens matching not matching all matching parens
  2004-09-17 18:22         ` Stefan Monnier
@ 2004-09-17 18:36           ` Arjan Bos
  0 siblings, 0 replies; 12+ messages in thread
From: Arjan Bos @ 2004-09-17 18:36 UTC (permalink / raw)


Stefan Monnier wrote:

>>(define-generic-mode 'rtf-generic-mode
>>   nil
>>   nil
>>   (list "\\\\\\([a-z]+\\(-?[0-9]+\\)? ?\\)")
>>   (list "\\.[rR][tT][fF]")
>>   nil)
> 
> 
> Try
> 
> (defvar rtf-font-lock-keywords
>   '("\\\\\\([a-z]+\\(-?[0-9]+\\)? ?\\)"))
> 
> (defvar rtf-mode-syntax-table
>   (let ((st (make-syntax-table)))
>     (modify-syntax-entry ?\( "." st)
>     (modify-syntax-entry ?\) "." st)
>     (modify-syntax-entry ?\[ "." st)
>     (modify-syntax-entry ?\] "." st)
>     st))
> 
> ;;;###autoload
> (add-to-list 'auto-mode-alist '("\\.[rR][tT][fF]\\'" . rtf-mode))
> 
> (define-derived-mode rtf-mode text-mode "RTF"
>   "Major mode for Rich Text Format."
>   (set (make-local-variable 'font-lock-defaults)
>        '(rtf-font-lock-keywords)))
> 
> 
> -- Stefan
Stefan,

As always, your info is great, thanks! But I solved it by browsing 
generic-x.el and applying the needed changes.

btw, did you notice that indenting the syntax-table elisp above has 
problems with the parentheses and brackets?

Arjan

-- 
--
If you really want to contact me, then replace the "I see you" text by 
its three letter accronym, hetnet.

Fabricate Diem PVNC, Motto of the Night Watch -- Terry Pratchett

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

* Re: parens matching not matching all matching parens
  2004-09-17 17:29   ` Arjan Bos
@ 2004-09-17 20:43     ` Greg Hill
  0 siblings, 0 replies; 12+ messages in thread
From: Greg Hill @ 2004-09-17 20:43 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 4530 bytes --]

At 7:29 PM +0200 9/17/04, Arjan Bos wrote:
>I already had something similar. Looking at the current bracket 
>under point, finding its opposite and start counting the brackets 
>you encounter. Another of the same bracket ups the ante, the 
>opposite pops one from the ante. When the ante is empty, all bets 
>are off, and the bracket is found.
>
>My code isn't perfect, so I will borrow heavily from yours.
>
>Thanks!

Arjan,
I cleaned up my code to the point that it will also work in place of 
the regular forward-sexp and backward-sexp for everyday use.  Here is 
a copy, if you're interested.  Please let me know if you try it and 
find any problems.  I will be using it myself as a permenant 
replacement for forward-sexp and backward-sexp.  If you are 
interested in being notified of any problems I may find, please let 
me know.

(defun skip-string-forward (&optional limit)
   (if (eq (char-after) ?\")
       (catch 'done
	(forward-char 1)
	(while t
	  (skip-chars-forward "^\\\\\"" limit)
	  (cond ((eq (point) limit)
		 (throw 'done nil) )
		((eq (char-after) ?\")
		 (forward-char 1)
		 (throw 'done nil) )
		(t
		 (forward-char 1)
		 (if (eq (point) limit)
		     (throw 'done nil)
		   (forward-char 1) ) ) ) ) ) ) )

(defun skip-string-backward (&optional limit)
   (if (eq (char-before) ?\")
       (catch 'done
	(forward-char -1)
	(while t
	  (skip-chars-backward "^\"" limit)
	  (if (eq (point) limit)
	      (throw 'done nil) )
	  (forward-char -1)
	  (if (eq (point) limit)
	      (throw 'done nil) )
	  (if (not (eq (char-before) ?\\))
	      (throw 'done nil) ) ) ) ) )



(defun forward-pexp (&optional arg)
   (interactive "p")
   (or arg (setq arg 1))
   (let (open close next notstrc notstro notstre depth pair)
     (catch 'done
       (cond ((> arg 0)
	     (skip-chars-forward " \t\n")
	     (if (not (memq (char-after) '(?\( ?\[ ?\{ ?\<)))
		 (goto-char (or (scan-sexps (point) arg) (buffer-end arg)))
	       (skip-chars-forward "^([{<\"")
	       (while (eq (char-after) ?\")
		 (skip-string-forward)
		 (skip-chars-forward "^([{<\"") )
	       (setq open (char-after))
	       (if (setq close (cadr (assq open '( (?\( ?\))
						   (?\[ ?\])
						   (?\{ ?\})
						   (?\< ?\>) ) ) ) )
		   (progn
		     (setq notstro (string ?^ open ?\")
			   notstre (string ?^ open close ?\") )
		     (while (and (> arg 0) (not (eobp)))
		       (skip-chars-forward notstro)
		       (while (eq (char-after) ?\")
			 (if (eq (char-before) ?\\)
			     (forward-char 1)
			   (skip-string-forward) )
			 (skip-chars-forward notstro) )
		       (forward-char 1)
		       (setq depth 1)
		       (while (and (> depth 0) (not (eobp)))
			 (skip-chars-forward notstre)
			 (while (eq (char-after) ?\")
			   (if (eq (char-before) ?\\)
			       (forward-char 1)
			     (skip-string-forward) )
			   (skip-chars-forward notstre) )
			 (setq next (char-after))
			 (cond ((eq next open)
				(setq depth (1+ depth)) )
			       ((eq next close)
				(setq depth (1- depth)) )
			       (t
				(throw 'done nil) ) )
			 (forward-char 1) )
		       (setq arg (1- arg) ) ) ) ) ) )
	    ((< arg 0)
	     (skip-chars-backward " \t\t")
	     (if (not (memq (char-before) '(?\) ?\] ?\} ?\>)))
		 (progn
		   (goto-char (or (scan-sexps (point) arg) (buffer-end arg)))
		   (backward-prefix-chars) )
	       (skip-chars-backward "^)]}>\"")
	       (while (eq (char-before) ?\")
		 (skip-string-backward)
		 (skip-chars-backward "^)]}>\"") )
	       (setq close (char-before))
	       (if (setq open (cadr (assq close '( (?\) ?\()
						   (?\] ?\[)
						   (?\} ?\{)
						   (?\> ?\<) ) ) ) )
		   (progn
		     (setq notstrc (string ?^ close ?\")
			   notstre (string ?^ close open ?\") )
		     (while (and (< arg 0) (not (bobp)))
		       (skip-chars-backward notstrc)
		       (while (eq (char-before) ?\")
			 (if (eq (char-before (1- (point))) ?\\)
			     (forward-char -1)
			   (skip-string-backward) )
			 (skip-chars-backward notstrc) )
		       (forward-char -1)
		       (setq depth 1)
		       (while (and (> depth 0) (not (bobp)))
			 (skip-chars-backward notstre)
			 (while (eq (char-before) ?\")
			   (if (eq (char-before (1- (point))) ?\\)
			       (forward-char -1)
			     (skip-string-backward) )
			   (skip-chars-backward notstre) )
			 (setq next (char-before))
			 (cond ((eq next close)
				(setq depth (1+ depth)) )
			       ((eq next open)
				(setq depth (1- depth)) )
			       (t
				(throw 'done nil) ) )
			 (forward-char -1) )
		       (setq arg (1+ arg)) ) ) ) ) ) ) ) ))


--Greg

[-- Attachment #1.2: Type: text/html, Size: 25968 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: parens matching not matching all matching parens
  2004-09-17 18:17         ` Stefan Monnier
@ 2004-09-18  0:25           ` Miles Bader
  0 siblings, 0 replies; 12+ messages in thread
From: Miles Bader @ 2004-09-18  0:25 UTC (permalink / raw)


Stefan Monnier <monnier@iro.umontreal.ca> writes:
> The generic-mode stuff is fine for very very simple stuff, but nothing else.
> And sadly it doesn't naturally extend from one step to the other.

Oh, I don't know, define-generic-mode lets you specify a list of "mode
init functions" which you can use to set stuff like syntax-tables.  The
one generic mode I've made adds a syntax table that way, and I plan to
add a simple indentation engine in a similar way.

The main benefit of using generic-mode AFAICS is that it offers a pretty
painless way to avoid the baroqueness of font-lock -- you just give it a
simple list of "language keywords" and set up your syntax table
correctly and it does everything else.

-Miles
-- 
I'm beginning to think that life is just one long Yoko Ono album; no rhyme
or reason, just a lot of incoherent shrieks and then it's over.  --Ian Wolff

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

end of thread, other threads:[~2004-09-18  0:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-16 19:19 parens matching not matching all matching parens Arjan Bos
2004-09-16 19:42 ` J. David Boyd
     [not found] ` <mailman.3032.1095364141.1998.help-gnu-emacs@gnu.org>
2004-09-16 20:19   ` Arjan Bos
2004-09-16 21:45     ` Miles Bader
2004-09-17 17:25       ` Arjan Bos
2004-09-17 18:17         ` Stefan Monnier
2004-09-18  0:25           ` Miles Bader
2004-09-17 18:22         ` Stefan Monnier
2004-09-17 18:36           ` Arjan Bos
2004-09-17  2:18 ` Greg Hill
     [not found] ` <mailman.3063.1095387904.1998.help-gnu-emacs@gnu.org>
2004-09-17 17:29   ` Arjan Bos
2004-09-17 20:43     ` Greg Hill

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.