all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* scheme font-locking: (define ((foo ...) bar) ...)
@ 2010-07-09 12:56 Thien-Thi Nguyen
  2010-07-10  9:02 ` Štěpán Němec
  2010-07-12 17:13 ` Glenn Morris
  0 siblings, 2 replies; 5+ messages in thread
From: Thien-Thi Nguyen @ 2010-07-09 12:56 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

In Scheme mode, Emacs font locks the form:

(define (in-vicinity-proc dir)
  (lambda (filename)
    (in-vicinity dir filename)))

with ‘define’ as a keyword and ‘in-vicinity-proc’ as a function name,
using font-lock-{keyword,function-name}-face, respectively.  That's fine.
However, for this form:

(define ((in-vicinity-proc dir) filename)
  (in-vicinity dir filename))

then Emacs font locks only ‘define’.  I have locally modified
‘scheme-font-lock-keywords-1’ to change "zero or one parens"
to "zero or more parens" and that change seems to DTRT.
Could someone please review the patch below and apply it?

thi

_______________________________________________

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Improve-Scheme-font-locking-for-define-foo.patch --]
[-- Type: text/x-diff, Size: 1452 bytes --]

From 6bdb80748bda69436d47066365e352ac909fe450 Mon Sep 17 00:00:00 2001
From: Thien-Thi Nguyen <ttn@gnuvola.org>
Date: Fri, 9 Jul 2010 14:52:48 +0200
Subject: [PATCH] Improve Scheme font-locking for (define ((foo ...) ...) ...).

* lisp/progmodes/scheme.el (scheme-font-lock-keywords-1): To find
the declared object, ignore zero or more parens, not zero or one.
---
 lisp/ChangeLog           |    6 ++++++
 lisp/progmodes/scheme.el |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b3af13b..3c6d07d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2010-07-09  Thien-Thi Nguyen  <ttn@gnuvola.org>
+
+	Improve Scheme font-locking for (define ((foo ...) ...) ...).
+	* progmodes/scheme.el (scheme-font-lock-keywords-1): To find
+	the declared object, ignore zero or more parens, not zero or one.
+
 2010-07-08  Daiki Ueno  <ueno@unixuser.org>
 
 	* epa-file.el (epa-file-error, epa-file--find-file-not-found-function)
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index ce8a342..fb5eafe 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -307,7 +307,7 @@ See `run-hooks'."
                    "\\|-module"
 		   "\\)\\)\\>"
 		   ;; Any whitespace and declared object.
-		   "[ \t]*(?"
+		   "[ \t]*(*"
 		   "\\(\\sw+\\)?")
 	   '(1 font-lock-keyword-face)
 	   '(6 (cond ((match-beginning 3) font-lock-function-name-face)
-- 
1.6.3.2


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

* Re: scheme font-locking: (define ((foo ...) bar) ...)
  2010-07-09 12:56 scheme font-locking: (define ((foo ...) bar) ...) Thien-Thi Nguyen
@ 2010-07-10  9:02 ` Štěpán Němec
  2010-07-12  7:37   ` Thien-Thi Nguyen
  2010-07-12 17:13 ` Glenn Morris
  1 sibling, 1 reply; 5+ messages in thread
From: Štěpán Němec @ 2010-07-10  9:02 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: emacs-devel

Thien-Thi Nguyen <ttn@gnuvola.org> writes:

> In Scheme mode, Emacs font locks the form:
>
> (define (in-vicinity-proc dir)
>   (lambda (filename)
>     (in-vicinity dir filename)))
>
> with ‘define’ as a keyword and ‘in-vicinity-proc’ as a function name,
> using font-lock-{keyword,function-name}-face, respectively.  That's fine.
> However, for this form:
>
> (define ((in-vicinity-proc dir) filename)
>   (in-vicinity dir filename))

Out of curiosity -- how standard is this? I've never seen such a
definition before.

> then Emacs font locks only ‘define’.  I have locally modified
> ‘scheme-font-lock-keywords-1’ to change "zero or one parens"
> to "zero or more parens" and that change seems to DTRT.
> Could someone please review the patch below and apply it?

The bug list would have seemed a better place to post the patch.

[patch snipped]

Štěpán



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

* Re: scheme font-locking: (define ((foo ...) bar) ...)
  2010-07-10  9:02 ` Štěpán Němec
@ 2010-07-12  7:37   ` Thien-Thi Nguyen
  0 siblings, 0 replies; 5+ messages in thread
From: Thien-Thi Nguyen @ 2010-07-12  7:37 UTC (permalink / raw)
  To: Štěpán Němec; +Cc: emacs-devel

() Štěpán Němec <stepnem@gmail.com>
() Sat, 10 Jul 2010 11:02:35 +0200

   Out of curiosity -- how standard is this?
   I've never seen such a definition before.

Guile supports it.  I believe other scheme implementations, too.

   The bug list would have seemed a better place to post the patch.

Thanks for the tip; i'll keep that in mind.

thi



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

* Re: scheme font-locking: (define ((foo ...) bar) ...)
  2010-07-09 12:56 scheme font-locking: (define ((foo ...) bar) ...) Thien-Thi Nguyen
  2010-07-10  9:02 ` Štěpán Němec
@ 2010-07-12 17:13 ` Glenn Morris
  2010-07-12 20:16   ` Thien-Thi Nguyen
  1 sibling, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2010-07-12 17:13 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: emacs-devel

Thien-Thi Nguyen wrote:

> then Emacs font locks only ‘define’.  I have locally modified
> ‘scheme-font-lock-keywords-1’ to change "zero or one parens"
> to "zero or more parens" and that change seems to DTRT.
> Could someone please review the patch below and apply it?

Looks ok to me. Feel free to apply it to the trunk yourself.




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

* Re: scheme font-locking: (define ((foo ...) bar) ...)
  2010-07-12 17:13 ` Glenn Morris
@ 2010-07-12 20:16   ` Thien-Thi Nguyen
  0 siblings, 0 replies; 5+ messages in thread
From: Thien-Thi Nguyen @ 2010-07-12 20:16 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

() Glenn Morris <rgm@gnu.org>
() Mon, 12 Jul 2010 13:13:59 -0400

   Looks ok to me. Feel free to apply it to the trunk yourself.

OK.  Thanks for the review.

thi



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

end of thread, other threads:[~2010-07-12 20:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-09 12:56 scheme font-locking: (define ((foo ...) bar) ...) Thien-Thi Nguyen
2010-07-10  9:02 ` Štěpán Němec
2010-07-12  7:37   ` Thien-Thi Nguyen
2010-07-12 17:13 ` Glenn Morris
2010-07-12 20:16   ` Thien-Thi Nguyen

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.