Commit cb7f3653 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

Use define-minor-mode in CEDET where applicable.

* cedet/srecode/mode.el (srecode-minor-mode,global-srecode-minor-mode):
Use define-minor-mode.

* cedet/semantic/util-modes.el (semantic-add-minor-mode):
Remove unused arg `keymap' and code redundant with define-minor-mode.
(semantic-toggle-minor-mode-globally): Only handle arg -1 and 1.
(semantic-stickyfunc-mode, global-semantic-show-unmatched-syntax-mode)
(semantic-highlight-func-mode, global-semantic-show-parser-state-mode)
(global-semantic-highlight-edits-mode, semantic-highlight-edits-mode)
(semantic-show-unmatched-syntax-mode, semantic-show-parser-state-mode)
(global-semantic-stickyfunc-mode, global-semantic-highlight-func-mode):
Use define-minor-mode.
(semantic-stickyfunc-mode-setup, semantic-highlight-edits-mode-setup)
(semantic-show-unmatched-syntax-mode-setup)
(semantic-show-parser-state-mode-setup)
(semantic-highlight-func-mode-setup): Inline into sole caller.

* cedet/semantic/mru-bookmark.el (global-semantic-mru-bookmark-mode)
(semantic-mru-bookmark-mode): Use define-minor-mode.
(semantic-mru-bookmark-mode-setup): Inline into sole caller.

* cedet/semantic/idle.el (define-semantic-idle-service):
Use define-minor-mode and inline setup function into its sole caller.
(semantic-idle-scheduler-mode-setup)
(semantic-idle-summary-mode-setup): Inline into sole caller.
(global-semantic-idle-scheduler-mode, semantic-idle-scheduler-mode):
Use define-minor-mode.

* cedet/semantic/decorate/mode.el (global-semantic-decoration-mode)
(semantic-decoration-mode): Use define-minor-mode.
(semantic-decoration-mode-setup): Inline into sole caller.

* cedet/ede/dired.el (ede-dired-minor-mode): Initialize in declaration.
(ede-dired-minor-mode): Use define-minor-mode and derived-mode-p.
(ede-dired-add-to-target): Use dolist.
parent a5a1e2ef
2010-05-02 Stefan Monnier <monnier@iro.umontreal.ca>
Use define-minor-mode in CEDET where applicable.
* cedet/srecode/mode.el (srecode-minor-mode,global-srecode-minor-mode):
Use define-minor-mode.
* cedet/semantic/util-modes.el (semantic-add-minor-mode):
Remove unused arg `keymap' and code redundant with define-minor-mode.
(semantic-toggle-minor-mode-globally): Only handle arg -1 and 1.
(semantic-stickyfunc-mode, global-semantic-show-unmatched-syntax-mode)
(semantic-highlight-func-mode, global-semantic-show-parser-state-mode)
(global-semantic-highlight-edits-mode, semantic-highlight-edits-mode)
(semantic-show-unmatched-syntax-mode, semantic-show-parser-state-mode)
(global-semantic-stickyfunc-mode, global-semantic-highlight-func-mode):
Use define-minor-mode.
(semantic-stickyfunc-mode-setup, semantic-highlight-edits-mode-setup)
(semantic-show-unmatched-syntax-mode-setup)
(semantic-show-parser-state-mode-setup)
(semantic-highlight-func-mode-setup): Inline into sole caller.
* cedet/semantic/mru-bookmark.el (global-semantic-mru-bookmark-mode)
(semantic-mru-bookmark-mode): Use define-minor-mode.
(semantic-mru-bookmark-mode-setup): Inline into sole caller.
* cedet/semantic/idle.el (define-semantic-idle-service):
Use define-minor-mode and inline setup function into its sole caller.
(semantic-idle-scheduler-mode-setup)
(semantic-idle-summary-mode-setup): Inline into sole caller.
(global-semantic-idle-scheduler-mode, semantic-idle-scheduler-mode):
Use define-minor-mode.
* cedet/semantic/decorate/mode.el (global-semantic-decoration-mode)
(semantic-decoration-mode): Use define-minor-mode.
(semantic-decoration-mode-setup): Inline into sole caller.
* cedet/ede/dired.el (ede-dired-minor-mode): Initialize in declaration.
(ede-dired-minor-mode): Use define-minor-mode and derived-mode-p.
(ede-dired-add-to-target): Use dolist.
2010-05-01 Toru TSUNEYOSHI <t_tuneyosi@hotmail.com>
Michael Albinus <michael.albinus@gmx.de>
......@@ -8,8 +48,8 @@
(tramp-inline-compress-commands): New defconst.
(tramp-find-inline-compress, tramp-get-inline-compress)
(tramp-get-inline-coding): New defuns.
(tramp-get-remote-coding, tramp-get-local-coding): Removed,
replaced by `tramp-get-inline-coding'.
(tramp-get-remote-coding, tramp-get-local-coding): Remove,
replace by `tramp-get-inline-coding'.
(tramp-handle-file-local-copy, tramp-handle-write-region)
(tramp-method-out-of-band-p): Use `tramp-get-inline-coding'.
......@@ -41,8 +81,7 @@
2010-04-30 Chong Yidong <cyd@stupidchicken.com>
* minibuffer.el (tags-completion-at-point-function): Fix return
value.
* minibuffer.el (tags-completion-at-point-function): Fix return value.
2010-04-30 Eli Zaretskii <eliz@gnu.org>
......
......@@ -27,57 +27,46 @@
;; This provides a dired interface to EDE, allowing users to modify
;; their project file by adding files (or whatever) directly from a
;; dired buffer.
(eval-when-compile (require 'cl))
(require 'easymenu)
(require 'dired)
(require 'ede)
;;; Code:
(defvar ede-dired-minor-mode nil
"Non-nil when in ede dired minor mode.")
(make-variable-buffer-local 'ede-dired-minor-mode)
(defvar ede-dired-keymap nil
(defvar ede-dired-keymap
(let ((map (make-sparse-keymap)))
(define-key map ".a" 'ede-dired-add-to-target)
(define-key map ".t" 'ede-new-target)
(define-key map ".s" 'ede-speedbar)
(define-key map ".C" 'ede-compile-project)
(define-key map ".d" 'ede-make-dist)
(easy-menu-define
ede-dired-menu map "EDE Dired Minor Mode Menu"
'("Project"
[ "Add files to target" ede-dired-add-to-target (ede-current-project) ]
( "Build" :filter ede-build-forms-menu)
"-"
[ "Create Project" ede-new (not (ede-current-project)) ]
[ "Create Target" ede-new-target (ede-current-project) ]
"-"
( "Customize Project" :filter ede-customize-forms-menu )
[ "View Project Tree" ede-speedbar (ede-current-project) ]
))
map)
"Keymap used for ede dired minor mode.")
(if ede-dired-keymap
nil
(setq ede-dired-keymap (make-sparse-keymap))
(define-key ede-dired-keymap ".a" 'ede-dired-add-to-target)
(define-key ede-dired-keymap ".t" 'ede-new-target)
(define-key ede-dired-keymap ".s" 'ede-speedbar)
(define-key ede-dired-keymap ".C" 'ede-compile-project)
(define-key ede-dired-keymap ".d" 'ede-make-dist)
(easy-menu-define
ede-dired-menu ede-dired-keymap "EDE Dired Minor Mode Menu"
'("Project"
[ "Add files to target" ede-dired-add-to-target (ede-current-project) ]
( "Build" :filter ede-build-forms-menu)
"-"
[ "Create Project" ede-new (not (ede-current-project)) ]
[ "Create Target" ede-new-target (ede-current-project) ]
"-"
( "Customize Project" :filter ede-customize-forms-menu )
[ "View Project Tree" ede-speedbar (ede-current-project) ]
))
)
(defun ede-dired-minor-mode (&optional arg)
(define-minor-mode ede-dired-minor-mode
"A minor mode that should only be activated in DIRED buffers.
If ARG is nil, toggle, if it is a positive number, force on, if
If ARG is nil or a positive number, force on, if
negative, force off."
(interactive "P")
(if (not (or (eq major-mode 'dired-mode)
(eq major-mode 'vc-dired-mode)))
(error "Not in DIRED mode"))
(setq ede-dired-minor-mode
(not (or (and (null arg) ede-dired-minor-mode)
(<= (prefix-numeric-value arg) 0))))
(if (and (not (ede-directory-project-p default-directory))
(not (interactive-p)))
(setq ede-dired-minor-mode nil))
)
:lighter " EDE" :keymap ede-dired-keymap
(unless (derived-mode-p 'dired-mode)
(setq ede-dired-minor-mode nil)
(error "Not in DIRED mode"))
(unless (or (ede-directory-project-p default-directory)
(interactive-p))
(setq ede-dired-minor-mode nil)))
(defun ede-dired-add-to-target (target)
"Add a file, or all marked files into a TARGET."
......@@ -85,24 +74,13 @@ negative, force off."
(let ((ede-object (ede-current-project)))
(ede-invoke-method 'project-interactive-select-target
"Add files to Target: "))))
(let ((files (dired-get-marked-files t)))
(while files
(project-add-file target (car files))
;; Find the buffer for this files, and set it's ede-object
(if (get-file-buffer (car files))
(with-current-buffer (get-file-buffer (car files))
(setq ede-object nil)
(setq ede-object (ede-buffer-object (current-buffer)))))
;; Increment.
(setq files (cdr files)))))
;; Minor mode management.
(add-to-list 'minor-mode-alist '(ede-dired-minor-mode " EDE"))
(let ((a (assoc 'ede-dired-minor-mode minor-mode-map-alist)))
(if a
(setcdr a ede-dired-keymap)
(add-to-list 'minor-mode-map-alist (cons 'ede-dired-minor-mode
ede-dired-keymap))))
(dolist (file (dired-get-marked-files t))
(project-add-file target file)
;; Find the buffer for this files, and set it's ede-object
(if (get-file-buffer file)
(with-current-buffer (get-file-buffer file)
(setq ede-object nil)
(setq ede-object (ede-buffer-object (current-buffer)))))))
(provide 'ede/dired)
......
......@@ -224,46 +224,34 @@ Flush functions from `semantic-decorate-pending-decoration-hook'."
;; Generic mode for handling basic highlighting and decorations.
;;
(defcustom global-semantic-decoration-mode nil
"*If non-nil, enable global use of command `semantic-decoration-mode'.
When this mode is activated, decorations specified by
`semantic-decoration-styles'."
:group 'semantic
:group 'semantic-modes
:type 'boolean
:require 'semantic/decorate/mode
:initialize 'custom-initialize-default
:set (lambda (sym val)
(global-semantic-decoration-mode (if val 1 -1))))
;;;###autoload
(defun global-semantic-decoration-mode (&optional arg)
(define-minor-mode global-semantic-decoration-mode
"Toggle global use of option `semantic-decoration-mode'.
Decoration mode turns on all active decorations as specified
by `semantic-decoration-styles'.
If ARG is positive, enable, if it is negative, disable.
If ARG is nil, then toggle."
(interactive "P")
(setq global-semantic-decoration-mode
(semantic-toggle-minor-mode-globally
'semantic-decoration-mode arg)))
by `semantic-decoration-styles'."
:global t :group 'semantic :group 'semantic-modes
;; Not needed because it's autoloaded instead.
;; :require 'semantic/decorate/mode
(semantic-toggle-minor-mode-globally
'semantic-decoration-mode (if global-semantic-decoration-mode 1 -1)))
(defcustom semantic-decoration-mode-hook nil
"Hook run at the end of function `semantic-decoration-mode'."
:group 'semantic
:type 'hook)
;;;;###autoload
(defvar semantic-decoration-mode nil
"Non-nil if command `semantic-decoration-mode' is enabled.
Use the command `semantic-decoration-mode' to change this variable.")
(make-variable-buffer-local 'semantic-decoration-mode)
(defun semantic-decoration-mode-setup ()
"Setup the `semantic-decoration-mode' minor mode.
The minor mode can be turned on only if the semantic feature is available
and the current buffer was set up for parsing. Return non-nil if the
(define-minor-mode semantic-decoration-mode
"Minor mode for decorating tags.
Decorations are specified in `semantic-decoration-styles'.
You can define new decoration styles with
`define-semantic-decoration-style'.
With prefix argument ARG, turn on if positive, otherwise off. The
minor mode can be turned on only if semantic feature is available and
the current buffer was set up for parsing. Return non-nil if the
minor mode is enabled."
;;
;;\\{semantic-decoration-map}"
nil nil nil
(if semantic-decoration-mode
(if (not (and (featurep 'semantic) (semantic-active-p)))
(progn
......@@ -280,8 +268,7 @@ minor mode is enabled."
'semantic-decorate-tags-after-full-reparse nil t)
;; Add decorations to available tags. The above hooks ensure
;; that new tags will be decorated when they become available.
(semantic-decorate-add-decorations (semantic-fetch-available-tags))
)
(semantic-decorate-add-decorations (semantic-fetch-available-tags)))
;; Remove decorations from available tags.
(semantic-decorate-clear-decorations (semantic-fetch-available-tags))
;; Cleanup any leftover crap too.
......@@ -290,41 +277,11 @@ minor mode is enabled."
(remove-hook 'semantic-after-partial-cache-change-hook
'semantic-decorate-tags-after-partial-reparse t)
(remove-hook 'semantic-after-toplevel-cache-change-hook
'semantic-decorate-tags-after-full-reparse t)
)
semantic-decoration-mode)
(defun semantic-decoration-mode (&optional arg)
"Minor mode for decorating tags.
Decorations are specified in `semantic-decoration-styles'.
You can define new decoration styles with
`define-semantic-decoration-style'.
With prefix argument ARG, turn on if positive, otherwise off. The
minor mode can be turned on only if semantic feature is available and
the current buffer was set up for parsing. Return non-nil if the
minor mode is enabled."
;;
;;\\{semantic-decoration-map}"
(interactive
(list (or current-prefix-arg
(if semantic-decoration-mode 0 1))))
(setq semantic-decoration-mode
(if arg
(>
(prefix-numeric-value arg)
0)
(not semantic-decoration-mode)))
(semantic-decoration-mode-setup)
(run-hooks 'semantic-decoration-mode-hook)
(if (called-interactively-p 'interactive)
(message "decoration-mode minor mode %sabled"
(if semantic-decoration-mode "en" "dis")))
(semantic-mode-line-update)
semantic-decoration-mode)
'semantic-decorate-tags-after-full-reparse t))
(semantic-mode-line-update))
(semantic-add-minor-mode 'semantic-decoration-mode
""
nil)
"")
(defun semantic-decorate-tags-after-full-reparse (tag-list)
"Add decorations after a complete reparse of the current buffer.
......
......@@ -128,16 +128,6 @@ unlikely the user would be ready to type again right away."
;; The minor mode portion of this code just sets up the minor mode
;; which does the initial scheduling of the idle timers.
;;
;;;###autoload
(defcustom global-semantic-idle-scheduler-mode nil
"*If non-nil, enable global use of idle-scheduler mode."
:group 'semantic
:group 'semantic-modes
:type 'boolean
:require 'semantic/idle
:initialize 'custom-initialize-default
:set (lambda (sym val)
(global-semantic-idle-scheduler-mode (if val 1 -1))))
(defcustom semantic-idle-scheduler-mode-hook nil
"Hook run at the end of the function `semantic-idle-scheduler-mode'."
......@@ -167,24 +157,8 @@ exceeds the `semantic-idle-scheduler-max-buffer-size' threshold."
(or (<= semantic-idle-scheduler-max-buffer-size 0)
(< (buffer-size) semantic-idle-scheduler-max-buffer-size))))
(defun semantic-idle-scheduler-mode-setup ()
"Setup option `semantic-idle-scheduler-mode'.
The minor mode can be turned on only if semantic feature is available
and the current buffer was set up for parsing. When minor mode is
enabled parse the current buffer if needed. Return non-nil if the
minor mode is enabled."
(if semantic-idle-scheduler-mode
(if (not (and (featurep 'semantic) (semantic-active-p)))
(progn
;; Disable minor mode if semantic stuff not available
(setq semantic-idle-scheduler-mode nil)
(error "Buffer %s was not set up idle time scheduling"
(buffer-name)))
(semantic-idle-scheduler-setup-timers)))
semantic-idle-scheduler-mode)
;;;###autoload
(defun semantic-idle-scheduler-mode (&optional arg)
(define-minor-mode semantic-idle-scheduler-mode
"Minor mode to auto parse buffer following a change.
When this mode is off, a buffer is only rescanned for tokens when
some command requests the list of available tokens. When idle-scheduler
......@@ -195,26 +169,19 @@ With prefix argument ARG, turn on if positive, otherwise off. The
minor mode can be turned on only if semantic feature is available and
the current buffer was set up for parsing. Return non-nil if the
minor mode is enabled."
(interactive
(list (or current-prefix-arg
(if semantic-idle-scheduler-mode 0 1))))
(setq semantic-idle-scheduler-mode
(if arg
(>
(prefix-numeric-value arg)
0)
(not semantic-idle-scheduler-mode)))
(semantic-idle-scheduler-mode-setup)
(run-hooks 'semantic-idle-scheduler-mode-hook)
(if (called-interactively-p 'interactive)
(message "idle-scheduler minor mode %sabled"
(if semantic-idle-scheduler-mode "en" "dis")))
(semantic-mode-line-update)
semantic-idle-scheduler-mode)
nil nil nil
(if semantic-idle-scheduler-mode
(if (not (and (featurep 'semantic) (semantic-active-p)))
(progn
;; Disable minor mode if semantic stuff not available
(setq semantic-idle-scheduler-mode nil)
(error "Buffer %s was not set up idle time scheduling"
(buffer-name)))
(semantic-idle-scheduler-setup-timers)))
(semantic-mode-line-update))
(semantic-add-minor-mode 'semantic-idle-scheduler-mode
"ARP"
nil)
"ARP")
;;; SERVICES services
;;
......@@ -582,31 +549,23 @@ This routine creates the following functions and variables:"
(mode (intern (concat (symbol-name name) "-mode")))
(hook (intern (concat (symbol-name name) "-mode-hook")))
(map (intern (concat (symbol-name name) "-mode-map")))
(setup (intern (concat (symbol-name name) "-mode-setup")))
(func (intern (concat (symbol-name name) "-idle-function"))))
`(eval-and-compile
(defun ,global (&optional arg)
(define-minor-mode ,global
,(concat "Toggle " (symbol-name global) ".
With ARG, turn the minor mode on if ARG is positive, off otherwise.
When this minor mode is enabled, `" (symbol-name mode) "' is
turned on in every Semantic-supported buffer.")
(interactive "P")
(setq ,global
(semantic-toggle-minor-mode-globally
',mode arg)))
(defcustom ,global nil
,(concat "Non-nil if `" (symbol-name mode) "' is enabled.")
:global t
:group 'semantic
:group 'semantic-modes
:type 'boolean
:require 'semantic/idle
:initialize 'custom-initialize-default
:set (lambda (sym val)
(,global (if val 1 -1))))
(semantic-toggle-minor-mode-globally
',mode (if ,global 1 -1)))
;; FIXME: Get rid of this when define-minor-mode does it for us.
(defcustom ,hook nil
,(concat "Hook run at the end of function `" (symbol-name mode) "'.")
:group 'semantic
......@@ -617,14 +576,9 @@ turned on in every Semantic-supported buffer.")
km)
,(concat "Keymap for `" (symbol-name mode) "'."))
(defvar ,mode nil
,(concat "Non-nil if the minor mode `" (symbol-name mode) "' is enabled.
Use the command `" (symbol-name mode) "' to change this variable."))
(make-variable-buffer-local ',mode)
(defun ,setup ()
,(concat "Set up `" (symbol-name mode) "'.
Return non-nil if the minor mode is enabled.")
(define-minor-mode ,mode
,doc
:keymap ,map
(if ,mode
(if (not (and (featurep 'semantic) (semantic-active-p)))
(progn
......@@ -633,36 +587,13 @@ Return non-nil if the minor mode is enabled.")
(error "Buffer %s was not set up for parsing"
(buffer-name)))
;; Enable the mode mode
(semantic-idle-scheduler-add #',func)
)
(semantic-idle-scheduler-add #',func))
;; Disable the mode mode
(semantic-idle-scheduler-remove #',func)
)
,mode)
(defun ,mode (&optional arg)
,doc
(interactive
(list (or current-prefix-arg
(if ,mode 0 1))))
(setq ,mode
(if arg
(>
(prefix-numeric-value arg)
0)
(not ,mode)))
(,setup)
(run-hooks ,hook)
(if (called-interactively-p 'interactive)
(message "%s %sabled"
(symbol-name ',mode)
(if ,mode "en" "dis")))
(semantic-mode-line-update)
,mode)
(semantic-idle-scheduler-remove #',func))
(semantic-mode-line-update))
(semantic-add-minor-mode ',mode
"" ; idle schedulers are quiet?
,map)
"") ; idle schedulers are quiet?
(defun ,func ()
,(concat "Perform idle activity for the minor mode `"
......@@ -814,21 +745,6 @@ When this minor mode is enabled, the echo area displays a summary
of the lexical token at point whenever Emacs is idle."
:group 'semantic
:group 'semantic-modes
(semantic-idle-summary-mode-setup)
(semantic-mode-line-update))
(defun semantic-idle-summary-refresh-echo-area ()
(and semantic-idle-summary-mode
eldoc-last-message
(if (and (not executing-kbd-macro)
(not (and (boundp 'edebug-active) edebug-active))
(not cursor-in-echo-area)
(not (eq (selected-window) (minibuffer-window))))
(eldoc-message eldoc-last-message)
(setq eldoc-last-message nil))))
(defun semantic-idle-summary-mode-setup ()
"Set up `semantic-idle-summary-mode'."
(if semantic-idle-summary-mode
;; Enable the mode
(progn
......@@ -843,7 +759,17 @@ of the lexical token at point whenever Emacs is idle."
;; Disable the mode
(semantic-idle-scheduler-remove 'semantic-idle-summary-idle-function)
(remove-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t))
semantic-idle-summary-mode)
(semantic-mode-line-update))
(defun semantic-idle-summary-refresh-echo-area ()
(and semantic-idle-summary-mode
eldoc-last-message
(if (and (not executing-kbd-macro)
(not (and (boundp 'edebug-active) edebug-active))
(not cursor-in-echo-area)
(not (eq (selected-window) (minibuffer-window))))
(eldoc-message eldoc-last-message)
(setq eldoc-last-message nil))))
(semantic-add-minor-mode 'semantic-idle-summary-mode "")
......@@ -957,22 +883,22 @@ Call `semantic-symref-hits-in-region' to identify local references."
;;;###autoload
(defun global-semantic-idle-scheduler-mode (&optional arg)
(define-minor-mode global-semantic-idle-scheduler-mode
"Toggle global use of option `semantic-idle-scheduler-mode'.
The idle scheduler will automatically reparse buffers in idle time,
and then schedule other jobs setup with `semantic-idle-scheduler-add'.
If ARG is positive, enable, if it is negative, disable.
If ARG is nil, then toggle."
(interactive "P")
If ARG is positive or nil, enable, if it is negative, disable."
:global t
:group 'semantic
:group 'semantic-modes
;; When turning off, disable other idle modes.
(when (or (and (numberp arg) (< arg 0))
(and (null arg) global-semantic-idle-scheduler-mode))
(when (null global-semantic-idle-scheduler-mode)
(global-semantic-idle-summary-mode -1)
(global-semantic-idle-tag-highlight-mode -1)
(global-semantic-idle-completions-mode -1))
(setq global-semantic-idle-scheduler-mode
(semantic-toggle-minor-mode-globally
'semantic-idle-scheduler-mode arg)))
(semantic-toggle-minor-mode-globally
'semantic-idle-scheduler-mode
(if global-semantic-idle-scheduler-mode 1 -1)))
;;; Completion Popup Mode
......
......@@ -239,27 +239,15 @@ This function pushes tags onto the tag ring."
;;
;; Tracking minor mode.
(defcustom global-semantic-mru-bookmark-mode nil
"If non-nil, enable `semantic-mru-bookmark-mode' globally.
When this mode is enabled, Emacs keeps track of which tags have
been edited, and you can re-visit them with \\[semantic-mrub-switch-tags]."
:group 'semantic
:group 'semantic-modes
:type 'boolean
:require 'semantic-util-modes
:initialize 'custom-initialize-default
:set (lambda (sym val)
(global-semantic-mru-bookmark-mode (if val 1 -1))))
;;;###autoload
(defun global-semantic-mru-bookmark-mode (&optional arg)
(define-minor-mode global-semantic-mru-bookmark-mode
"Toggle global use of option `semantic-mru-bookmark-mode'.
If ARG is positive, enable, if it is negative, disable.
If ARG is nil, then toggle."
(interactive "P")
(setq global-semantic-mru-bookmark-mode
(semantic-toggle-minor-mode-globally
'semantic-mru-bookmark-mode arg)))
If ARG is positive or nil, enable, if it is negative, disable."
:global t :group 'semantic :group 'semantic-modes
;; Not needed because it's autoloaded instead.
;; :require 'semantic-util-modes
(semantic-toggle-minor-mode-globally
'semantic-mru-bookmark-mode (if global-semantic-mru-bookmark-mode 1 -1)))
(defcustom semantic-mru-bookmark-mode-hook nil
"*Hook run at the end of function `semantic-mru-bookmark-mode'."
......@@ -272,17 +260,18 @@ If ARG is nil, then toggle."
km)
"Keymap for mru-bookmark minor mode.")
(defvar semantic-mru-bookmark-mode nil
"Non-nil if mru-bookmark minor mode is enabled.
Use the command `semantic-mru-bookmark-mode' to change this variable.")
(make-variable-buffer-local 'semantic-mru-bookmark-mode)
(define-minor-mode semantic-mru-bookmark-mode
"Minor mode for tracking tag-based bookmarks automatically.
When this mode is enabled, Emacs keeps track of which tags have
been edited, and you can re-visit them with \\[semantic-mrub-switch-tags].
\\{semantic-mru-bookmark-mode-map}
(defun semantic-mru-bookmark-mode-setup ()
"Setup option `semantic-mru-bookmark-mode'.
The minor mode can be turned on only if semantic feature is available
and the current buffer was set up for parsing. When minor mode is
enabled parse the current buffer if needed. Return non-nil if the
With prefix argument ARG, turn on if positive, otherwise off. The
minor mode can be turned on only if semantic feature is available and
the current buffer was set up for parsing. Return non-nil if the
minor mode is enabled."
:keymap semantic-mru-bookmark-mode-map
(if semantic-mru-bookmark-mode
(if (not (and (featurep 'semantic) (semantic-active-p)))
(progn
......@@ -294,47 +283,16 @@ minor mode is enabled."
(add-hook 'semantic-edits-new-change-hooks
'semantic-mru-bookmark-change-hook-fcn nil t)
(add-hook 'semantic-edits-move-change-hooks
'semantic-mru-bookmark-change-hook-fcn nil t)
)
'semantic-mru-bookmark-change-hook-fcn nil t))
;; Remove hooks