all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Enhancing font-locking in emacs-lisp-mode
@ 2008-06-05 19:37 Nordlöw
  2008-06-05 22:02 ` Nikolaj Schumacher
  0 siblings, 1 reply; 2+ messages in thread
From: Nordlöw @ 2008-06-05 19:37 UTC (permalink / raw)
  To: help-gnu-emacs

Hi again!

Some thoughts regarding enhancements of font-locking in emacs-lisp-
mode; I believe the readability of emacs-lisp code would be greatly
enhanced by also highlighting the following cases

- arguments to function/macro definition (defun/defmacro) in font-lock-
variable-name-face
- local variable names defined by the let/let* statement
- function name part of function calls: I guess this is hard/
(impossible?) to get right for all cases but maybe we could somehow
reuse `functionp' in the MATCHER to better filter out the more
relevant cases?

Does anyone have any tips on how to go about implementing this. For
the second case I believe I have to use a function matcher in font-
lock-keywords that navigates in the sub-expression structure (forward/
backward-sexp, backward-up-list, down-list). I now know how regexp-
MATCHERs work. Does anyone have any good tutorial on how to design
these function-MATCHERS?

Is it adviced to solve this as an add-on or is it best to let the GNU
Emacs hackers add this functionality to lisp-mode.el?

/Nordlöw


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

* Re: Enhancing font-locking in emacs-lisp-mode
  2008-06-05 19:37 Enhancing font-locking in emacs-lisp-mode Nordlöw
@ 2008-06-05 22:02 ` Nikolaj Schumacher
  0 siblings, 0 replies; 2+ messages in thread
From: Nikolaj Schumacher @ 2008-06-05 22:02 UTC (permalink / raw)
  To: Nordlöw; +Cc: help-gnu-emacs

Nordlöw <per.nordlow@gmail.com> wrote:

> - function name part of function calls: I guess this is hard/
> (impossible?) to get right for all cases but maybe we could somehow
> reuse `functionp' in the MATCHER to better filter out the more
> relevant cases?

Something like this...?

(font-lock-add-keywords emacs-lisp-mode
(eval-when-compile
   '(("\\_<\\(?:\\s_\\|\\sw\\)+\\_>"
      (0 (let ((symbol (intern (match-string 0))))
           (cond
            ((macrop symbol) 'font-lock-macro-name-face)
            ((fboundp symbol) 'font-lock-function-name-face)
            ((or (boundp symbol) (facep symbol))
             'font-lock-variable-name-face))))))))

(font-lock-macro-name-face is a face defined by me.)

Let me know when you make any progress.  I'm very interested. :)


regards,
Nikolaj Schumacher




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

end of thread, other threads:[~2008-06-05 22:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-05 19:37 Enhancing font-locking in emacs-lisp-mode Nordlöw
2008-06-05 22:02 ` Nikolaj Schumacher

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.