[Nice-commit] Nice/lib/emacs nice-mode.el,1.31,1.32
Brought to you by:
bonniot
From: <bo...@us...> - 2003-12-10 14:31:22
|
Update of /cvsroot/nice/Nice/lib/emacs In directory sc8-pr-cvs1:/tmp/cvs-serv20006/lib/emacs Modified Files: nice-mode.el Log Message: Made the Emacs mode work on XEmacs, which probably also fixes problems with recent versions of GNU Emacs. Index: nice-mode.el =================================================================== RCS file: /cvsroot/nice/Nice/lib/emacs/nice-mode.el,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** nice-mode.el 31 Jul 2003 18:45:35 -0000 1.31 --- nice-mode.el 10 Dec 2003 14:31:19 -0000 1.32 *************** *** 51,55 **** (defconst nice-extension-regexp "\\.nice$") ! (defvar nice-compile-buffer "*Nice*" "Name of buffer fo Nice compilations") --- 51,55 ---- (defconst nice-extension-regexp "\\.nice$") ! (defvar nice-compilation-buffer "*Nice*" "Name of buffer fo Nice compilations") *************** *** 321,327 **** (defconst c-Nice-comment-start-regexp "/\\(/\\|[*][*]?\\)") (defconst c-Nice-class-key (concat ! "\\(" c-protection-key "\\s +\\)?" "\\(interface\\|class\\|device\\)\\s +" c-symbol-key ;name of the class --- 321,329 ---- (defconst c-Nice-comment-start-regexp "/\\(/\\|[*][*]?\\)") + (defconst c-Nice-protection-key "\\<\\(public\\|private\\)\\>") + (defconst c-Nice-class-key (concat ! "\\(" c-Nice-protection-key "\\s +\\)?" "\\(interface\\|class\\|device\\)\\s +" c-symbol-key ;name of the class *************** *** 425,428 **** --- 427,431 ---- ;(make-local-variable 'compilation-exit-message-function) (setq compilation-exit-message-function 'nice-compilation-exit) + (setq compilation-finish-function 'nice-compilation-finish-function) (local-set-key "\C-c\C-b" 'nice-compile-buffer) *************** *** 498,503 **** (if nice-process (delete-process nice-process)) ! (if (get-buffer nice-compile-buffer) ! (kill-buffer nice-compile-buffer)) (save-buffer) --- 501,506 ---- (if nice-process (delete-process nice-process)) ! (if (get-buffer nice-compilation-buffer) ! (kill-buffer nice-compilation-buffer)) (save-buffer) *************** *** 519,523 **** (setq default-directory nice-directory) ! (setq nice-compile-buffer (compile-internal cmd "No more errors")) ;; Start process --- 522,526 ---- (setq default-directory nice-directory) ! (setq nice-compilation-buffer (compile-internal cmd "No more errors")) ;; Start process *************** *** 526,539 **** ;(setq nice-compiling t) ;; Display the compilation buffer ! ;(display-buffer nice-compile-buffer) ) ) ! (defun nice-compilation-exit (process-status exit-status exit-message) (cond ! ((eq exit-status 0) ! (let ((win (get-buffer-window nice-compile-buffer))) ! (if win (delete-window win))) ! '("successful" . "OK")) ((eq exit-status 1) '("Compiler bug" . "Bug")) ((eq exit-status 2) (save-excursion (next-error) '("error" . "error"))) --- 529,550 ---- ;(setq nice-compiling t) ;; Display the compilation buffer ! ;(display-buffer nice-compilation-buffer) ) ) ! (defun nice-remove-empty (l) ! (if l ! (if (equal (car l) "") ! (nice-remove-empty (cdr l)) (cons (car l) (nice-remove-empty (cdr l)))) ! nil)) ! ! (defun nice-compilation-exit (process-status exit-status &optional exit-message) ! ; XEmacs (21.4) does not seem to always provide exit-message ! ; and its exit-status is a string like "Exited with status code X". ! (let ((exit-status ! (if (integerp exit-status) exit-status ! (string-to-number (car (last (nice-remove-empty (split-string exit-status)))))))) (cond ! ((eq exit-status 0) '("successful" . "OK")) ((eq exit-status 1) '("Compiler bug" . "Bug")) ((eq exit-status 2) (save-excursion (next-error) '("error" . "error"))) *************** *** 541,544 **** --- 552,564 ---- (t '("Unknown exit status" . "")) ) + )) + + (defun nice-compilation-finish-function (buffer result) + "Handle the end of a Nice compilation." + (let ((ok + (if (integerp result) + (eq result 0) + (not (string-match "abnormally" result))))) + (if ok (delete-window (get-buffer-window buffer)))) ) *************** *** 546,550 **** "Find next Nice error." (interactive) ! (let ((buffer (get-buffer nice-compile-buffer)) start file l1 c1 l2 c2) (if (not buffer) --- 566,570 ---- "Find next Nice error." (interactive) ! (let ((buffer (get-buffer nice-compilation-buffer)) start file l1 c1 l2 c2) (if (not buffer) *************** *** 675,679 **** ;; Return the root a of package given a file of the package (defun nice-root (file) ! (let* ((spl (split-string file "/")) (pkg (split-string (nice-buffer-pkg-name) "[.]")) (nlevels (length pkg))) --- 695,700 ---- ;; Return the root a of package given a file of the package (defun nice-root (file) ! ; Under XEmacs (21.4), split-string returns leading and trailing "" elements. ! (let* ((spl (nice-remove-empty (split-string file "/"))) (pkg (split-string (nice-buffer-pkg-name) "[.]")) (nlevels (length pkg))) *************** *** 1189,1193 **** (let (process (default-directory dir)) ! (setq process (apply #'start-process "nice" nice-compile-buffer (car cmd) (cdr cmd))) (set-process-filter process 'nice-process-filter) (set-process-sentinel process 'nice-process-sentinel) --- 1210,1214 ---- (let (process (default-directory dir)) ! (setq process (apply #'start-process "nice" nice-compilation-buffer (car cmd) (cdr cmd))) (set-process-filter process 'nice-process-filter) (set-process-sentinel process 'nice-process-sentinel) *************** *** 1265,1269 **** (if (string-match "^[0-9]+$" name) (save-excursion ! (set-buffer nice-compile-buffer) (goto-char (point-max)) (if (nice-search-backward --- 1286,1290 ---- (if (string-match "^[0-9]+$" name) (save-excursion ! (set-buffer nice-compilation-buffer) (goto-char (point-max)) (if (nice-search-backward |