/[emacs]/emacs/lisp/menu-bar.el
ViewVC logotype

Diff of /emacs/lisp/menu-bar.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.227 by monnier, Fri Sep 6 20:27:59 2002 UTC revision 1.228 by monnier, Wed Sep 11 21:56:50 2002 UTC
# Line 563  PROPS are additional properties." Line 563  PROPS are additional properties."
563       :button (:toggle . (and (default-boundp ',fname)       :button (:toggle . (and (default-boundp ',fname)
564                               (default-value ',fname)))))                               (default-value ',fname)))))
565    
566  (defmacro menu-bar-make-toggle (name variable doc message help &optional props &rest body)  (defmacro menu-bar-make-toggle (name variable doc message help &rest body)
567    `(progn    `(progn
568       (defun ,name ()       (defun ,name ()
569         ,(concat "Toggle whether to " (downcase (substring help 0 1))         ,(concat "Toggle whether to " (downcase (substring help 0 1))
# Line 576  PROPS are additional properties." Line 576  PROPS are additional properties."
576                         (get (or (get ',variable 'custom-get) 'default-value)))                         (get (or (get ',variable 'custom-get) 'default-value)))
577                     (funcall set ',variable (not (funcall get ',variable))))))                     (funcall set ',variable (not (funcall get ',variable))))))
578             (message ,message "enabled")             (message ,message "enabled")
579           (message ,message "disabled")))           (message ,message "disabled"))
580       ;; The function `customize-mark-as-set' must only be called when         ;; The function `customize-mark-as-set' must only be called when
581       ;; a variable is set interactively, as the purpose is to mark it         ;; a variable is set interactively, as the purpose is to mark it as
582       ;; as a candidate for "Save Options", and we do not want to save         ;; a candidate for "Save Options", and we do not want to save options
583       ;; options the user have already set explicitly in his init         ;; the user have already set explicitly in his init file.
584       ;; file.  Unfortunately, he could very likely call the function         (if (interactive-p) (customize-mark-as-set ',variable)))
585       ;; defined above there.  So we put `customize-mark-as-set' in a       '(menu-item ,doc ,name
      ;; lambda expression.  
      ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.  
      '(menu-item ,doc (lambda ()  
                         (interactive)  
                         (,name)  
                         (customize-mark-as-set ',variable))  
                  ,@(if props props)  
586                   :help ,help                   :help ,help
587                   :button (:toggle . (and (default-boundp ',variable)                   :button (:toggle . (and (default-boundp ',variable)
588                                           (default-value ',variable))))))                                           (default-value ',variable))))))
# Line 637  PROPS are additional properties." Line 630  PROPS are additional properties."
630  (defvar menu-bar-showhide-menu (make-sparse-keymap "Show/Hide"))  (defvar menu-bar-showhide-menu (make-sparse-keymap "Show/Hide"))
631    
632  (define-key menu-bar-showhide-menu [column-number-mode]  (define-key menu-bar-showhide-menu [column-number-mode]
633    (menu-bar-make-toggle toggle-column-number-mode column-number-mode    (menu-bar-make-mm-toggle column-number-mode
634                          "Show Column Numbers" "Column number mode %s"                             "Show Column Numbers"
635                          "Show the current column number in the mode line"))                             "Show the current column number in the mode line"))
636    
637  (define-key menu-bar-showhide-menu [line-number-mode]  (define-key menu-bar-showhide-menu [line-number-mode]
638    (menu-bar-make-toggle toggle-line-number-mode line-number-mode    (menu-bar-make-mm-toggle line-number-mode
639                          "Show Line Numbers" "Line number mode %s"                             "Show Line Numbers"
640                          "Show the current line number in the mode line"))                             "Show the current line number in the mode line"))
641    
642  (define-key menu-bar-showhide-menu [linecolumn-separator]  (define-key menu-bar-showhide-menu [linecolumn-separator]
643    '("--"))    '("--"))
# Line 850  PROPS are additional properties." Line 843  PROPS are additional properties."
843                          "Use Directory Names in Buffer Names"                          "Use Directory Names in Buffer Names"
844                          "Directory name in buffer names (uniquify) %s"                          "Directory name in buffer names (uniquify) %s"
845                          "Uniquify buffer names by adding parent directory names"                          "Uniquify buffer names by adding parent directory names"
                         () ; no props  
846                          (require 'uniquify)                          (require 'uniquify)
847                          (setq uniquify-buffer-name-style                          (setq uniquify-buffer-name-style
848                                (if (not uniquify-buffer-name-style)                                (if (not uniquify-buffer-name-style)
# Line 908  paste (in addition to the normal Emacs b Line 900  paste (in addition to the normal Emacs b
900  (define-key menu-bar-options-menu [highlight-paren-mode]  (define-key menu-bar-options-menu [highlight-paren-mode]
901    (menu-bar-make-mm-toggle show-paren-mode    (menu-bar-make-mm-toggle show-paren-mode
902                             "Paren Match Highlighting"                             "Paren Match Highlighting"
903                          "Highlight matching/mismatched parentheses at cursor (Show Paren mode)"))                             "Highlight matching/mismatched parentheses at cursor (Show Paren mode)"))
904  (define-key menu-bar-options-menu [transient-mark-mode]  (define-key menu-bar-options-menu [transient-mark-mode]
905    (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode    (menu-bar-make-mm-toggle transient-mark-mode
906                          "Active Region Highlighting"                             "Active Region Highlighting"
907                          "Transient Mark mode %s"                             "Make text in active region stand out in color (Transient Mark mode)"
908                          "Make text in active region stand out in color (Transient Mark mode)"                             (:enable (not cua-mode))))
                         (:enable (not cua-mode))))  
909  (define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode]  (define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode]
910    (menu-bar-make-mm-toggle global-font-lock-mode    (menu-bar-make-mm-toggle global-font-lock-mode
911                             "Syntax Highlighting"                             "Syntax Highlighting"
# Line 1540  Buffers menu is regenerated." Line 1531  Buffers menu is regenerated."
1531  (menu-bar-update-buffers)  (menu-bar-update-buffers)
1532    
1533  ;; this version is too slow  ;; this version is too slow
1534  ;;;(defun format-buffers-menu-line (buffer)  ;;(defun format-buffers-menu-line (buffer)
1535  ;;;  "Returns a string to represent the given buffer in the Buffer menu.  ;;  "Returns a string to represent the given buffer in the Buffer menu.
1536  ;;;nil means the buffer shouldn't be listed.  You can redefine this."  ;;nil means the buffer shouldn't be listed.  You can redefine this."
1537  ;;;  (if (string-match "\\` " (buffer-name buffer))  ;;  (if (string-match "\\` " (buffer-name buffer))
1538  ;;;      nil  ;;      nil
1539  ;;;    (save-excursion  ;;    (save-excursion
1540  ;;;     (set-buffer buffer)  ;;     (set-buffer buffer)
1541  ;;;     (let ((size (buffer-size)))  ;;     (let ((size (buffer-size)))
1542  ;;;       (format "%s%s %-19s %6s %-15s %s"  ;;       (format "%s%s %-19s %6s %-15s %s"
1543  ;;;            (if (buffer-modified-p) "*" " ")  ;;             (if (buffer-modified-p) "*" " ")
1544  ;;;            (if buffer-read-only "%" " ")  ;;             (if buffer-read-only "%" " ")
1545  ;;;            (buffer-name)  ;;             (buffer-name)
1546  ;;;            size  ;;             size
1547  ;;;            mode-name  ;;             mode-name
1548  ;;;            (or (buffer-file-name) ""))))))  ;;             (or (buffer-file-name) ""))))))
1549    
1550  ;;; Set up a menu bar menu for the minibuffer.  ;;; Set up a menu bar menu for the minibuffer.
1551    

Legend:
Removed from v.1.227  
changed lines
  Added in v.1.228

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26