From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Masatake YAMATO Newsgroups: gmane.emacs.devel Subject: Re: font-lock in machine mode of gdba Date: Tue, 19 Oct 2004 11:26:47 +0900 (JST) Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <20041019.112647.212948122.jet@gyve.org> References: <20041018.002930.45492341.jet@gyve.org> <16755.10649.857644.666785@farnswood.snap.net.nz> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1098153038 2146 80.91.229.6 (19 Oct 2004 02:30:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 19 Oct 2004 02:30:38 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 19 04:30:28 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CJjlc-0000xQ-00 for ; Tue, 19 Oct 2004 04:30:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CJjsw-0002PT-7z for ged-emacs-devel@m.gmane.org; Mon, 18 Oct 2004 22:38:02 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CJjsn-0002PO-Pr for emacs-devel@gnu.org; Mon, 18 Oct 2004 22:37:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CJjsn-0002PC-Bv for emacs-devel@gnu.org; Mon, 18 Oct 2004 22:37:53 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CJjsn-0002P9-9D for emacs-devel@gnu.org; Mon, 18 Oct 2004 22:37:53 -0400 Original-Received: from [210.130.136.40] (helo=r-maa.spacetown.ne.jp) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CJjku-0000zm-71 for emacs-devel@gnu.org; Mon, 18 Oct 2004 22:29:44 -0400 Original-Received: from localhost (h219-110-075-243.catv01.itscom.jp [219.110.75.243]) by r-maa.spacetown.ne.jp (8.11.6) with ESMTP id i9J2TdK07676; Tue, 19 Oct 2004 11:29:39 +0900 (JST) Original-To: nickrob@snap.net.nz In-Reply-To: <16755.10649.857644.666785@farnswood.snap.net.nz> X-Mailer: Mew version 4.0.62 on Emacs 21.3.50 / Mule 5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:28588 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:28588 > > 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 > > > > * 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