unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Vincent Belaïche" <vincent.b.1@hotmail.fr>
To: emacs-devel@gnu.org
Subject: progmodes cc: addition of builtin def-const
Date: Mon, 03 Dec 2012 21:01:54 +0100	[thread overview]
Message-ID: <80boeaaor1.fsf@gmail.com> (raw)

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

Hello,

DXL has a number of language specific functions which I think would be
better to fontify like builtins, similar to what is done in AWK.

On the other hand DXL is more typed than AWK, so the 3 level
fontification of cc-fonts.el is better to use than do a specific
fontification like in AWK mode.

In order to achieve this goal of reusing cc-fonts, I propose the
addition of a new lang constant c-builtin-kwds. This allows the
dxl-mode.el which I am elaborating to plug more readily on EMACS CC
progmode.

If nobody objects I would commit the change the patch thereof is herein
attached.

VBR,
  Vincent.


[-- Attachment #2: cc-builtin.diff --]
[-- Type: text/x-patch, Size: 2114 bytes --]

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2012-12-03 17:23:42 +0000
+++ lisp/ChangeLog	2012-12-03 19:55:20 +0000
@@ -1,3 +1,12 @@
+2012-12-03  Vincent Belaïche  <vincentb1@users.sourceforge.net>
+
+	* progmodes/cc-fonts.el (c-basic-matchers-before): Use new lang
+	constant `c-builtin-kwds' for handling language specific keyword
+	fontification.
+
+	* progmodes/cc-langs.el (c-builtin-kwds): New lang constant for
+	handling language specific keyword fontification.
+
 2012-12-03  Agustín Martín Domingo  <agustin.martin@hispalinux.es>
 
 	* textmodes/ispell.el (ispell-init-process)

=== modified file 'lisp/progmodes/cc-langs.el'
--- lisp/progmodes/cc-langs.el	2012-09-13 18:41:21 +0000
+++ lisp/progmodes/cc-langs.el	2012-12-03 17:24:59 +0000
@@ -649,6 +649,15 @@
 	 (prefix "::")
 	 (left-assoc ".")))
 
+(c-lang-defconst c-builtin-kwds
+  "Keywords for builtin keywords constants."
+  ;; This is for functions that are not part of a library but builtin in the
+  ;; language. AWK mode does not use this constant but could have done
+  ;; so. Currently this is used only as a hook for languages not yes part of
+  ;; cc-xxx progmode, like DXL.
+  t       nil
+  )
+
 (c-lang-defconst c-opt-identifier-concat-key
   ;; Appendable adorned regexp matching the operators that join
   ;; symbols to fully qualified identifiers, or nil in languages that

=== modified file 'lisp/progmodes/cc-fonts.el'
--- lisp/progmodes/cc-fonts.el	2012-01-19 07:21:25 +0000
+++ lisp/progmodes/cc-fonts.el	2012-12-03 17:26:28 +0000
@@ -763,6 +763,12 @@
 	      `((eval . (list ,(concat "\\<\\(" re "\\)\\>")
 			      1 c-constant-face-name))))))
 
+      ;; Fontify builtins keyword constants.
+      ,@(when (c-lang-const c-builtin-kwds)
+	  (let ((re (c-make-keywords-re nil (c-lang-const c-builtin-kwds))))
+	      `((eval . (list ,(concat "\\<\\(" re "\\)\\>")
+			      1 c-preprocessor-face-name)))))
+
       ;; Fontify all keywords except the primitive types.
       ,(if (c-major-mode-is 'pike-mode)
 	   ;; No symbol is a keyword after "->" in Pike.


             reply	other threads:[~2012-12-03 20:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-03 20:01 Vincent Belaïche [this message]
2012-12-10  6:24 ` progmodes cc: addition of builtin def-const Vincent Belaïche
2012-12-18  6:51   ` Vincent Belaïche
2012-12-19 20:17 ` Alan Mackenzie
2012-12-22 22:15   ` Vincent Belaïche

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80boeaaor1.fsf@gmail.com \
    --to=vincent.b.1@hotmail.fr \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).