From: "Ulrich Mueller (ulm)" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] emacs r1347 - gentoo-syntax
Date: Mon, 17 Aug 2009 06:48:52 +0000 [thread overview]
Message-ID: <E1Mcw1U-0004TU-31@stork.gentoo.org> (raw)
Author: ulm
Date: 2009-08-17 06:48:51 +0000 (Mon, 17 Aug 2009)
New Revision: 1347
Modified:
gentoo-syntax/ChangeLog
gentoo-syntax/gentoo-syntax.el
Log:
Collect all keywords for a font first, before computing their regexp.
Modified: gentoo-syntax/ChangeLog
===================================================================
--- gentoo-syntax/ChangeLog 2009-08-16 23:02:40 UTC (rev 1346)
+++ gentoo-syntax/ChangeLog 2009-08-17 06:48:51 UTC (rev 1347)
@@ -1,3 +1,12 @@
+2009-08-17 Ulrich Mueller <ulm@gentoo.org>
+
+ * gentoo-syntax.el (ebuild-mode-font-lock-keywords)
+ (eselect-mode-font-lock-keywords): It is more efficient to collect
+ all keywords for a font first, before computing their regexp.
+ Thanks to Elias Pipping for pointing this out.
+ (ebuild-mode-collect-equal-cdrs): New function.
+ (ebuild-mode-make-keywords-list): Define also at compile time.
+
2009-08-16 Christian Faulhammer <fauli@gentoo.org>
* ebuild-mode-keywords.el (ebuild-mode-keywords-python):
Modified: gentoo-syntax/gentoo-syntax.el
===================================================================
--- gentoo-syntax/gentoo-syntax.el 2009-08-16 23:02:40 UTC (rev 1346)
+++ gentoo-syntax/gentoo-syntax.el 2009-08-17 06:48:51 UTC (rev 1347)
@@ -55,31 +55,50 @@
;; suppress byte-compiler warning
(defvar ebuild-mode-menu)
-(defun ebuild-mode-make-keywords-list (keywords-list face
- &optional prefix suffix)
- ;; based on `generic-make-keywords-list' from generic.el
- ;; Note: XEmacs doesn't have generic.el
- (unless (listp keywords-list)
- (error "Keywords argument must be a list of strings"))
- (cons (concat prefix "\\<"
- (regexp-opt keywords-list t)
- "\\>" suffix)
- face))
+(eval-and-compile
+ (defun ebuild-mode-make-keywords-list (keywords-list face
+ &optional prefix suffix)
+ ;; based on `generic-make-keywords-list' from generic.el
+ ;; Note: XEmacs doesn't have generic.el
+ (unless (listp keywords-list)
+ (error "Keywords argument must be a list of strings"))
+ (cons (concat prefix "\\<"
+ (regexp-opt keywords-list t)
+ "\\>" suffix)
+ face))
-(load "ebuild-mode-keywords" nil t)
-(load "eselect-mode-keywords" nil t)
+ (defun ebuild-mode-collect-equal-cdrs (src)
+ "For alist SRC, collect elements with equal cdr and concat their cars."
+ (let (dst e)
+ (dolist (c src dst)
+ (if (setq e (rassoc (cdr c) dst))
+ (setcar e (append (car e) (car c)))
+ (setq dst (cons (copy-sequence c) dst))))))
+)
+(eval-when-compile
+ (load "ebuild-mode-keywords" nil t)
+ (load "eselect-mode-keywords" nil t))
+
(defvar ebuild-mode-font-lock-keywords
- (mapcar
- (lambda (x)
- (apply 'ebuild-mode-make-keywords-list (symbol-value (intern x))))
- (all-completions "ebuild-mode-keywords-" obarray 'boundp)))
+ (eval-when-compile
+ (mapcar
+ (lambda (x)
+ (apply 'ebuild-mode-make-keywords-list x))
+ (ebuild-mode-collect-equal-cdrs
+ (mapcar
+ (lambda (x) (symbol-value (intern x)))
+ (all-completions "ebuild-mode-keywords-" obarray 'boundp))))))
(defvar eselect-mode-font-lock-keywords
- (mapcar
- (lambda (x)
- (apply 'ebuild-mode-make-keywords-list (symbol-value (intern x))))
- (all-completions "eselect-mode-keywords-" obarray 'boundp)))
+ (eval-when-compile
+ (mapcar
+ (lambda (x)
+ (apply 'ebuild-mode-make-keywords-list x))
+ (ebuild-mode-collect-equal-cdrs
+ (mapcar
+ (lambda (x) (symbol-value (intern x)))
+ (all-completions "eselect-mode-keywords-" obarray 'boundp))))))
(font-lock-add-keywords 'ebuild-mode ebuild-mode-font-lock-keywords)
(font-lock-add-keywords 'eselect-mode eselect-mode-font-lock-keywords)
reply other threads:[~2009-08-17 6:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=E1Mcw1U-0004TU-31@stork.gentoo.org \
--to=ulm@gentoo.org \
--cc=gentoo-commits@lists.gentoo.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox