changeset 93178:6c44d22f4d83

(finder-mode-syntax-table, finder-font-lock-keywords): New variables. (finder-mode): Use finder-mode-syntax-table. Set font-lock-defaults. (finder-exit): Ignore errors rather than avoiding them. Kill *Finder-package* buffer also.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 24 Mar 2008 18:43:04 +0000
parents 470ea273abbf
children 139d0b227fdc
files lisp/ChangeLog lisp/finder.el
diffstat 2 files changed, 29 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Mar 24 09:28:05 2008 +0000
+++ b/lisp/ChangeLog	Mon Mar 24 18:43:04 2008 +0000
@@ -1,3 +1,11 @@
+2008-03-22  Drew Adams  <drew.adams@oracle.com>
+
+	* finder.el (finder-mode-syntax-table, finder-font-lock-keywords):
+	New variables.
+	(finder-mode): Use finder-mode-syntax-table.  Set font-lock-defaults.
+	(finder-exit): Ignore errors rather than avoiding them.
+	Kill *Finder-package* buffer also.
+
 2008-03-24  Andreas Schwab  <schwab@suse.de>
 
 	* xt-mouse.el (xterm-mouse-event): Avoid error with buttons > 5.
@@ -7,8 +15,8 @@
 	* vc-hg.el (vc-hg-after-dir-status):
 	* vc-bzr.el (vc-bzr-after-dir-status): Detect missing files.
 
-	* vc-cvs.el (vc-cvs-after-dir-status, vc-cvs-parse-status): Detect
-	removed files.
+	* vc-cvs.el (vc-cvs-after-dir-status, vc-cvs-parse-status):
+	Detect removed files.
 
 	* vc.el (vc-status-printer): Use a different face for missing files.
 	(vc-status-hide-up-to-date): Rename from
--- a/lisp/finder.el	Mon Mar 24 09:28:05 2008 +0000
+++ b/lisp/finder.el	Mon Mar 24 18:43:04 2008 +0000
@@ -110,6 +110,16 @@
     (define-key map "d"	'finder-list-keywords)
     map))
 
+(defvar finder-mode-syntax-table
+  (let ((st (make-syntax-table emacs-lisp-mode-syntax-table)))
+    (modify-syntax-entry ?\; ".   " st)
+    st)
+  "Syntax table used while in `finder-mode'.")
+
+(defvar finder-font-lock-keywords
+  '(("`\\([^']+\\)'" 1 font-lock-constant-face prepend))
+  "Font-lock keywords for Finder mode.")
+
 
 ;;; Code for regenerating the keyword list.
 
@@ -343,7 +353,9 @@
   (interactive)
   (kill-all-local-variables)
   (use-local-map finder-mode-map)
-  (set-syntax-table emacs-lisp-mode-syntax-table)
+  (set-syntax-table finder-mode-syntax-table)
+  (setq font-lock-defaults '(finder-font-lock-keywords nil nil
+                             (("+-*/.<>=!?$%_&~^:@" . "w")) nil))
   (setq mode-name "Finder")
   (setq major-mode 'finder-mode)
   (set (make-local-variable 'finder-headmark) nil)
@@ -359,15 +371,13 @@
 finder directory, \\[finder-exit] = quit, \\[finder-summary] = help")))
 
 (defun finder-exit ()
-  "Exit Finder mode and kill the buffer."
+  "Exit Finder mode.
+Delete the window and kill the buffer."
   (interactive)
-  (or (one-window-p t)
-      (delete-window))
-  ;; Can happen in either buffer -- kill each of the two that exists
-  (and (get-buffer "*Finder*")
-       (kill-buffer "*Finder*"))
-  (and (get-buffer "*Finder Category*")
-       (kill-buffer "*Finder Category*")))
+  (condition-case nil (delete-window) (error nil))
+  (when (get-buffer "*Finder*") (kill-buffer "*Finder*"))
+  (when (get-buffer "*Finder-package*") (kill-buffer "*Finder-package*"))
+  (when (get-buffer "*Finder Category*") (kill-buffer "*Finder Category*")))
 
 
 (provide 'finder)