From: Masatake YAMATO <jet@gyve.org>
Cc: emacs-devel@gnu.org
Subject: Re: font-lock in machine mode of gdba
Date: Tue, 19 Oct 2004 11:26:47 +0900 (JST) [thread overview]
Message-ID: <20041019.112647.212948122.jet@gyve.org> (raw)
In-Reply-To: <16755.10649.857644.666785@farnswood.snap.net.nz>
> > I've defined font-lock keywords for `gdb-assembler-mode'. Please,
> > review the patch. I'm afraid the it is too decorative.
> >
> > 2004-10-18 Masatake YAMATO <jet@gyve.org>
> >
> > * progmodes/gdb-ui.el (gdb-ann3): Define a key which toggles
> > source view and assembler view.
> > (gdb-assembler-font-lock-keywords): New font lock keywords
> > definition.
> > (gdb-assembler-mode): Use 'gdb-assembler-font-lock-keywords'.
> >...
>
> I think it should at least be consistent with asm-mode where keywords like
> movl, andl, etc are fontified with font-lock-keyword-face and operands and
> registers are left unfontified.
I have changed both gdb-ui.el and asm-mode.el; and used the same face in the
both mode for the same object. Do you think operand fontification is too decorative?
Now font-lock-mode is turn-on in gdb-assembler-mode when global-font-lock-mode is
true. gdb-assembler-mode-hook is also provided. See the comments at the tail of
font-core.el.
Index: lisp/progmodes/gdb-ui.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/gdb-ui.el,v
retrieving revision 1.24
diff -u -r1.24 gdb-ui.el
--- lisp/progmodes/gdb-ui.el 6 Oct 2004 07:20:53 -0000 1.24
+++ lisp/progmodes/gdb-ui.el 19 Oct 2004 02:20:41 -0000
@@ -1939,6 +1960,19 @@
(suppress-keymap map)
map))
+(defvar gdb-assembler-font-lock-keywords
+ '(("[^\$]0x[0-9a-f]+" . font-lock-constant-face)
+ ("^\\(0x*[0-9a-f]+\\) ?\\(<\\(\\sw+\\)\\+[0-9]+>\\)?:[ \t]+\\(\\sw+\\)"
+ (1 font-lock-constant-face)
+ (3 font-lock-function-name-face)
+ (4 font-lock-keyword-face))
+ ("%\\sw+" . font-lock-variable-name-face)
+ ("^\\(Dump of assembler code for function\\) \\(.+\\):"
+ (1 font-lock-comment-face)
+ (2 font-lock-function-name-face))
+ ("^\\(End of assembler dump\\.\\)" . font-lock-comment-face))
+ "Font lock keywords used in `gdb-assembler-mode'.")
+
(defun gdb-assembler-mode ()
"Major mode for viewing code assembler.
@@ -1951,7 +1985,12 @@
(setq fringes-outside-margins t)
(setq buffer-read-only t)
(use-local-map gdb-assembler-mode-map)
- (gdb-invalidate-assembler))
+ (set (make-local-variable 'font-lock-defaults)
+ '(gdb-assembler-font-lock-keywords))
+ (when global-font-lock-mode
+ (font-lock-mode 1))
+ (gdb-invalidate-assembler)
+ (run-hooks 'gdb-assembler-mode-hook))
(defun gdb-assembler-buffer-name ()
(with-current-buffer gud-comint-buffer
Index: lisp/progmodes/asm-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/asm-mode.el,v
retrieving revision 1.28
diff -u -r1.28 asm-mode.el
--- lisp/progmodes/asm-mode.el 1 Sep 2003 15:45:34 -0000 1.28
+++ lisp/progmodes/asm-mode.el 19 Oct 2004 02:20:41 -0000
@@ -90,7 +90,10 @@
2 font-lock-keyword-face)
;; directive started from ".".
("^\\(\\.\\(\\sw\\|\\s_\\)+\\)\\>[^:]?"
- 1 font-lock-keyword-face))
+ 1 font-lock-keyword-face)
+ ;; %register
+ ("%\\sw+" . font-lock-variable-name-face)
+ )
"Additional expressions to highlight in Assembler mode.")
;;;###autoload
next prev parent reply other threads:[~2004-10-19 2:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-17 15:29 font-lock in machine mode of gdba Masatake YAMATO
2004-10-17 16:55 ` Stefan Monnier
2004-10-18 2:14 ` Nick Roberts
2004-10-18 2:25 ` Nick Roberts
2004-10-19 2:26 ` Masatake YAMATO [this message]
2004-10-19 12:45 ` Stefan Monnier
2004-10-21 10:53 ` Nick Roberts
2004-10-19 13:28 ` Nick Roberts
2004-10-19 13:54 ` Stefan Monnier
2004-10-19 14:27 ` Masatake YAMATO
2004-10-19 16:38 ` Masatake YAMATO
2004-10-23 22:09 ` Nick Roberts
2004-10-23 23:49 ` Masatake YAMATO
2004-10-23 23:59 ` Nick Roberts
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=20041019.112647.212948122.jet@gyve.org \
--to=jet@gyve.org \
--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.