# HG changeset patch # User Dan Nicolaescu # Date 1207118121 0 # Node ID a128a4284881c233672fddc4e7eec5ab78dca401 # Parent 8bdec2731742b32e9177195458bb406b5262a265 * emacs-lisp/debug.el (debugger-mode-map): * textmodes/conf-mode.el (conf-mode-map): Add a menu. (conf-align-assignments): Only work on the region if it is active. (conf-quote-normal): Use when instead of if. Remove redundant test. diff -r 8bdec2731742 -r a128a4284881 lisp/emacs-lisp/debug.el --- a/lisp/emacs-lisp/debug.el Wed Apr 02 06:29:40 2008 +0000 +++ b/lisp/emacs-lisp/debug.el Wed Apr 02 06:35:21 2008 +0000 @@ -585,7 +585,8 @@ (debugger-env-macro (eval-expression exp))) (defvar debugger-mode-map - (let ((map (make-keymap))) + (let ((map (make-keymap)) + (menu-map (make-sparse-keymap))) (set-keymap-parent map button-buffer-map) (suppress-keymap map) (define-key map "-" 'negative-argument) @@ -603,6 +604,49 @@ (define-key map "R" 'debugger-record-expression) (define-key map "\C-m" 'debug-help-follow) (define-key map [mouse-2] 'push-button) + (define-key map [menu-bar debugger] (cons "Debugger" menu-map)) + (define-key menu-map [deb-top] + '(menu-item "Quit" top-level + :help "Quit debugging and return to top leve")) + (define-key menu-map [deb-s0] '("--")) + (define-key menu-map [deb-descr] + '(menu-item "Describe Debugger Mode" describe-mode + :help "Display documentation for debugger-mode")) + (define-key menu-map [deb-hfol] + '(menu-item "Help Follow" debug-help-follow + :help "Follow cross-reference")) + (define-key menu-map [deb-nxt] + '(menu-item "Next Line" next-line + :help "Move cursor down")) + (define-key menu-map [deb-s1] '("--")) + (define-key menu-map [deb-lfunc] + '(menu-item "List debug on entry functions" debugger-list-functions + :help "Display a list of all the functions now set to debug on entry")) + (define-key menu-map [deb-fclear] + '(menu-item "Cancel debug frame" debugger-frame-clear + :help "Do not enter debugger when this frame exits")) + (define-key menu-map [deb-frame] + '(menu-item "Debug frame" debugger-frame + :help "Request entry to debugger when this frame exits")) + (define-key menu-map [deb-s2] '("--")) + (define-key menu-map [deb-ret] + '(menu-item "Return value..." debugger-return-value + :help "Continue, specifying value to return.")) + (define-key menu-map [deb-rec] + '(menu-item "Display and Record Expression" debugger-record-expression + :help "Display a variable's value and record it in `*Backtrace-record*' buffer")) + (define-key menu-map [deb-eval] + '(menu-item "Eval Expression..." debugger-eval-expression + :help "Eval an expression, in an environment like that outside the debugger")) + (define-key menu-map [deb-jump] + '(menu-item "Jump" debugger-jump + :help "Continue to exit from this frame, with all debug-on-entry suspended")) + (define-key menu-map [deb-cont] + '(menu-item "Continue" debugger-continue + :help "Continue, evaluating this expression without stopping")) + (define-key menu-map [deb-step] + '(menu-item "Step through" debugger-step-through + :help "Proceed, stepping through subexpressions of this expression")) map)) (put 'debugger-mode 'mode-class 'special) diff -r 8bdec2731742 -r a128a4284881 lisp/textmodes/conf-mode.el --- a/lisp/textmodes/conf-mode.el Wed Apr 02 06:29:40 2008 +0000 +++ b/lisp/textmodes/conf-mode.el Wed Apr 02 06:35:21 2008 +0000 @@ -69,9 +69,9 @@ :type 'boolean :group 'conf) - (defvar conf-mode-map - (let ((map (make-sparse-keymap))) + (let ((map (make-sparse-keymap)) + (menu-map (make-sparse-keymap))) (define-key map "\C-c\C-u" 'conf-unix-mode) (define-key map "\C-c\C-w" 'conf-windows-mode) (define-key map "\C-c\C-j" 'conf-javaprop-mode) @@ -85,6 +85,49 @@ (define-key map "\C-c\"" 'conf-quote-normal) (define-key map "\C-c'" 'conf-quote-normal) (define-key map "\C-c\C-a" 'conf-align-assignments) + (define-key map [menu-bar sh-script] (cons "Conf" menu-map)) + (define-key menu-map [conf-windows-mode] + '(menu-item "Windows mode" + conf-windows-mode + :help "Conf Mode starter for Windows style Conf files" + :button (:radio . (eq major-mode 'conf-windows-mode)))) + (define-key menu-map [conf-javaprop-mode] + '(menu-item "Java properties mode" + conf-javaprop-mode + :help "Conf Mode starter for Java properties files" + :button (:radio . (eq major-mode 'conf-javaprop-mode)))) + (define-key menu-map [conf-space-keywords] + '(menu-item "Space keywords mode..." + conf-space-keywords + :help "Enter Conf Space mode using regexp KEYWORDS to match the keywords" + :button (:radio . (eq major-mode 'conf-space-keywords)))) + (define-key menu-map [conf-ppd-mode] + '(menu-item "PPD mode" + conf-ppd-mode + :help "Conf Mode starter for Adobe/CUPS PPD files" + :button (:radio . (eq major-mode 'conf-ppd-mode)))) + (define-key menu-map [conf-colon-mode] + '(menu-item "Colon mode" + conf-colon-mode + :help "Conf Mode starter for Colon files" + :button (:radio . (eq major-mode 'conf-colon-mode)))) + (define-key menu-map [conf-unix-mode] + '(menu-item "Unix mode" + conf-unix-mode + :help "Conf Mode starter for Unix style Conf files" + :button (:radio . (eq major-mode 'conf-unix-mode)))) + (define-key menu-map [conf-xdefaults-mode] + '(menu-item "Xdefaults mode" + conf-xdefaults-mode + :help "Conf Mode starter for Xdefaults files" + :button (:radio . (eq major-mode 'conf-xdefaults-mode)))) + (define-key menu-map [c-s0] '("--")) + (define-key menu-map [conf-quote-normal] + '(menu-item "Set quote syntax normal" conf-quote-normal + :help "Set the syntax of \' and \" to punctuation")) + (define-key menu-map [conf-align-assignments] + '(menu-item "Align assignments" conf-align-assignments + :help "Align assignments")) map) "Local keymap for `conf-mode' buffers.") @@ -215,37 +258,43 @@ ;; `align', I'd be glad to hear. (defun conf-align-assignments (&optional arg) (interactive "P") + "Align the assignments in the buffer or active region. +In Transient Mark mode, if the mark is active, operate on the +contents of the region. Otherwise, operate on the whole buffer." (setq arg (if arg (prefix-numeric-value arg) conf-assignment-column)) (save-excursion - (goto-char (point-min)) - (while (not (eobp)) - (let ((cs (comment-beginning))) ; go before comment if within - (if cs (goto-char cs))) - (while (forward-comment 9)) ; max-int? - (when (and (not (eobp)) - (looking-at conf-assignment-regexp)) - (goto-char (match-beginning 1)) - (delete-region (point) (match-end 1)) - (if conf-assignment-sign - (if (>= arg 0) - (progn - (indent-to-column arg) + (save-restriction + (when (use-region-p) + (narrow-to-region (region-beginning) (region-end))) + (goto-char (point-min)) + (while (not (eobp)) + (let ((cs (comment-beginning))) ; go before comment if within + (if cs (goto-char cs))) + (while (forward-comment 9)) ; max-int? + (when (and (not (eobp)) + (looking-at conf-assignment-regexp)) + (goto-char (match-beginning 1)) + (delete-region (point) (match-end 1)) + (if conf-assignment-sign + (if (>= arg 0) + (progn + (indent-to-column arg) + (or (not conf-assignment-space) + (memq (char-before (point)) '(?\s ?\t)) (insert ?\s)) + (insert conf-assignment-sign + (if (and conf-assignment-space (not (eolp))) ?\s ""))) + (insert (if conf-assignment-space ?\s "") conf-assignment-sign) + (unless (eolp) + (indent-to-column (- arg)) (or (not conf-assignment-space) - (memq (char-before (point)) '(?\s ?\t)) (insert ?\s)) - (insert conf-assignment-sign - (if (and conf-assignment-space (not (eolp))) ?\s ""))) - (insert (if conf-assignment-space ?\s "") conf-assignment-sign) - (unless (eolp) - (indent-to-column (- arg)) - (or (not conf-assignment-space) - (memq (char-before (point)) '(?\s ?\t)) (insert ?\s)))) - (unless (eolp) - (if (>= (current-column) (abs arg)) - (insert ?\s) - (indent-to-column (abs arg)))))) - (forward-line)))) + (memq (char-before (point)) '(?\s ?\t)) (insert ?\s)))) + (unless (eolp) + (if (>= (current-column) (abs arg)) + (insert ?\s) + (indent-to-column (abs arg)))))) + (forward-line))))) (defun conf-quote-normal (arg) @@ -259,14 +308,13 @@ unbalanced, but hey...)" (interactive "P") (let ((table (copy-syntax-table (syntax-table)))) - (if (or (not arg) (= (prefix-numeric-value arg) 1)) - (modify-syntax-entry ?\' "." table)) - (if (or (not arg) (= (prefix-numeric-value arg) 2)) - (modify-syntax-entry ?\" "." table)) + (when (or (not arg) (= (prefix-numeric-value arg) 1)) + (modify-syntax-entry ?\' "." table)) + (when (or (not arg) (= (prefix-numeric-value arg) 2)) + (modify-syntax-entry ?\" "." table)) (set-syntax-table table) - (and (boundp 'font-lock-mode) - font-lock-mode - (font-lock-fontify-buffer)))) + (when font-lock-mode + (font-lock-fontify-buffer)))) (defun conf-outline-level ()