Commits

youngs  committed badcd33

2001-08-16 Steve Youngs <youngs@xemacs.org>

* setnu.el: Moved here from JDE package.

* Makefile (ELCS): Add setnu.elc

2001-08-16 Steve Youngs <youngs@xemacs.org>

* Makefile (ELCS): Add missing elcs remove obsolete.

* senator-isearch.el: Moved to semantic package.

* senator.el: Removed. It's in the semantic package.

* setnu.el: Moved to edit-utils package.

* Sync to 2.2.7.1

2001-08-16 Steve Youngs <youngs@xemacs.org>

* senator-isearch.el: Moved here from JDE.

* Sync to 1.4beta8

  • Participants
  • Parent commits c34c172
  • Tags jde-1_29

Comments (0)

Files changed (5)

+2001-08-16  Steve Youngs  <youngs@xemacs.org>
+
+	* Makefile (ELCS): Add missing elcs remove obsolete.
+
+	* senator-isearch.el: Moved to semantic package.
+
+	* senator.el: Removed.  It's in the semantic package.
+
+	* setnu.el: Moved to edit-utils package.
+
+	* Sync to 2.2.7.1
+
 2001-06-18  Ben Wing  <ben@xemacs.org>
 
 	* Makefile (PRELOADS):
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-VERSION = 1.28
+VERSION = 1.29
 AUTHOR_VERSION = 2.2.7.1
 MAINTAINER = Paul Kinnucan <paulk@mathworks.com>
 PACKAGE = jde
 	lisp/jde-wiz.elc \
 	lisp/jde.elc \
 	lisp/beanshell.elc \
-	lisp/setnu.elc \
 	lisp/tree-widget.elc
 
 EXTRA_SOURCES = 

File lisp/senator-isearch.el

-;;; senator-isearch.el --- SEmantic NAvigaTOR isearch support
-
-;; Copyright (C) 2000 by David Ponce
-
-;; Author: David Ponce <david@dponce.com>
-;; Maintainer: David Ponce <david@dponce.com>
-;; Created: 04 Dec 2000
-;; Version: 1.0
-;; Keywords: tools, syntax
-;; VC: $Id$
-
-;; This file is not part of Emacs
-
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation; either version 2, or (at
-;; your option) any later version.
-
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING.  If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-;; 
-;; This library improves isearch (and ishl) to allow overriding of the
-;; basic search functions used by `isearch-search' and
-;; `isearch-lazy-highlight-search' (or `ishl-search').
-;;
-;; This feature is needed by the SEmantic NAvigaTOR library to extend
-;; isearch with an incremental semantic search mode. When isearch is
-;; switched to this mode it searches only in language tokens in the
-;; current buffer.
-
-;; THIS CODE HAS ONLY BEEN TESTED WITH GNU EMACS 20.7, 21.0 AND XEMACS
-;; 21.1. GNU EMACS 20.7 REQUIRES ISHL 1.5 TO ENABLE ISEARCH LAZY
-;; HIGHLIGHTING.
-
-;;; Change Log:
-
-;; $Log$
-;; Revision 1.3  2001/01/03 15:41:11  david_ponce
-;; Improved isearch lazy highlighting support.
-;;
-;; Revision 1.2  2000/12/08 16:18:32  david_ponce
-;; A bunch of XEmacs compatibility code!
-;;
-;; Revision 1.1  2000/12/05 11:15:14  david_ponce
-;; Initial revision needed by senator.el 1.7 (version 2.0) and above.
-;;
-
-;;; Code:
-
-;;;;
-;;;; Improvement of `isearch-search' to use a customizable core search
-;;;; function provider.  This feature will probably be included in
-;;;; isearch starting with GNU Emacs 21.2.
-;;;; 
-
-(defcustom isearch-search-handler-provider 'isearch-default-search-handler
-  "Function providing the basic search handlers.
-The default function `isearch-default-search-handler' provides one the
-built-ins `search-forward', `search-backward', `word-search-forward',
-`word-search-backward', `re-search-forward' or `re-search-backward'
-depending on current values of variables `isearch-forward',
-`isearch-regexp' and `isearch-word'.  Any other user's defined basic
-search handler that `isearch-search-handler-provider' returns must
-accept the same arguments and have the same behaviour as the above
-built-in ones."
-  :group 'isearch
-  :type 'function)
-
-(defun isearch-default-search-handler ()
-  "Return the actual search function used by `isearch-search'.
-That is one of the built-in functions `search-forward',
-`search-backward', `word-search-forward', `word-search-backward',
-`re-search-forward' or `re-search-backward' depending on current
-values of variables `isearch-forward', `isearch-regexp' and
-`isearch-word'."
-  (cond (isearch-word
-         (if isearch-forward
-             'word-search-forward
-           'word-search-backward))
-        (isearch-regexp
-         (if isearch-forward
-             're-search-forward
-           're-search-backward))
-        (t
-         (if isearch-forward
-             'search-forward
-           'search-backward))))
-
-(cond ;; Compatibility between GNU Emacs and XEmacs
- 
- ((featurep 'xemacs) ;; XEmacs stuff
-
-  ;; Provide `isearch-update-ring' function (from 21.1.9 isearch-mode.el)
-  (defun isearch-update-ring (string &optional regexp)
-    "Add STRING to the beginning of the search ring.
-REGEXP says which ring to use."
-    (if (> (length string) 0)
-        ;; Update the ring data.
-        (if regexp 
-            (if (not (setq regexp-search-ring-yank-pointer
-                           (member string regexp-search-ring)))
-                (progn
-                  (setq regexp-search-ring
-                        (cons string regexp-search-ring)
-                        regexp-search-ring-yank-pointer regexp-search-ring)
-                  (if (> (length regexp-search-ring) regexp-search-ring-max)
-                      (setcdr (nthcdr (1- regexp-search-ring-max) regexp-search-ring)
-                              nil))))
-          (if (not (setq search-ring-yank-pointer
-                         ;; really need equal test instead of eq.
-                         (member string search-ring)))
-              (progn
-                (setq search-ring (cons string search-ring)
-                      search-ring-yank-pointer search-ring)
-                (if (> (length search-ring) search-ring-max)
-                    (setcdr (nthcdr (1- search-ring-max) search-ring) nil)))))))
-
-  ;; `isearch-search' from 21.1.9 isearch-mode.el
-  (defadvice isearch-search (around senator activate)
-      ;; Do the search with the current search string.
-      (isearch-message nil t)
-      (isearch-fix-case)
-      (condition-case lossage
-          (let ((inhibit-quit nil)
-                (case-fold-search isearch-case-fold-search))
-            (if isearch-regexp (setq isearch-invalid-regexp nil))
-            (setq isearch-success
-                  (funcall
-                   (if isearch-search-handler-provider
-                       (funcall isearch-search-handler-provider)
-                     (isearch-default-search-handler))
-                   isearch-string nil t))
-            (setq isearch-just-started nil)
-            (if isearch-success
-                (setq isearch-other-end
-                      (if isearch-forward (match-beginning 0) (match-end 0)))))
-
-        (quit (setq unread-command-event (character-to-event (quit-char)))
-              (setq isearch-success nil))
-
-        (invalid-regexp 
-         (setq isearch-invalid-regexp (car (cdr lossage)))
-         (if (string-match
-              "\\`Premature \\|\\`Unmatched \\|\\`Invalid "
-              isearch-invalid-regexp)
-             (setq isearch-invalid-regexp (gettext "incomplete input")))))
-
-      (if isearch-success
-          nil
-
-        ;; If we're being run inside a keyboard macro, then the call to
-        ;; ding will signal an error (to terminate the macro).  We must
-        ;; turn off isearch-mode first, so that we aren't still in isearch
-        ;; mode after the macro exits.  Note that isearch-recursive-edit
-        ;; must not be true if a keyboard macro is executing.
-        (if (and executing-kbd-macro (not defining-kbd-macro))
-            (progn
-              (isearch-done)
-              (ding nil 'isearch-failed)))
-
-        ;; Ding if failed this time after succeeding last time.
-        (and (nth 3 (car isearch-cmds))
-             (ding nil 'isearch-failed))
-        (goto-char (nth 2 (car isearch-cmds)))))
-  
-  ) ;; End of XEmacs stuff
-
- (t ;; GNU Emacs stuff
-  
-  ;; `isearch-search' from 20.7 (not changed in 21.0) isearch.el
-  (defadvice isearch-search (around senator activate)
-    ;; Do the search with the current search string.
-    (isearch-message nil t)
-    (if (and (eq isearch-case-fold-search t) search-upper-case)
-        (setq isearch-case-fold-search
-              (isearch-no-upper-case-p isearch-string isearch-regexp)))
-    (condition-case lossage
-        (let ((inhibit-point-motion-hooks search-invisible)
-              (inhibit-quit nil)
-              (case-fold-search isearch-case-fold-search)
-              (retry t))
-          (if isearch-regexp (setq isearch-invalid-regexp nil))
-          (setq isearch-within-brackets nil)
-          (while retry
-            (setq isearch-success
-                  (funcall
-                   (if isearch-search-handler-provider
-                       (funcall isearch-search-handler-provider)
-                     (isearch-default-search-handler))
-                   isearch-string nil t))
-            ;; Clear RETRY unless we matched some invisible text
-            ;; and we aren't supposed to do that.
-            (if (or (eq search-invisible t)
-                    (not isearch-success)
-                    (bobp) (eobp)
-                    (= (match-beginning 0) (match-end 0))
-                    (not (isearch-range-invisible
-                          (match-beginning 0) (match-end 0))))
-                (setq retry nil)))
-          (setq isearch-just-started nil)
-          (if isearch-success
-              (setq isearch-other-end
-                    (if isearch-forward (match-beginning 0) (match-end 0)))))
-          
-      (quit (isearch-unread ?\C-g)
-            (setq isearch-success nil))
-          
-      (invalid-regexp
-       (setq isearch-invalid-regexp (car (cdr lossage)))
-       (setq isearch-within-brackets (string-match "\\`Unmatched \\["
-                                                   isearch-invalid-regexp))
-       (if (string-match
-            "\\`Premature \\|\\`Unmatched \\|\\`Invalid "
-            isearch-invalid-regexp)
-           (setq isearch-invalid-regexp "incomplete input")))
-      (error
-       ;; stack overflow in regexp search.
-       (setq isearch-invalid-regexp (car (cdr lossage)))))
-
-    (setq ad-return-value
-          (if isearch-success
-              nil
-            ;; Ding if failed this time after succeeding last time.
-            (and (nth 3 (car isearch-cmds))
-                 (ding))
-            (goto-char (nth 2 (car isearch-cmds))))))
-
-  ) ;; End of GNU Emacs stuff
-
- ) ;; End of compatibility stuff
-
-;; Improvement of the isearch lazy highlighting feature to use the
-;; core search function provider. Lazy highlighting is part of isearch
-;; for GNU Emacs 21 or provided by the optional ishl.el library for
-;; Emacs 20.  Not currently implemented for XEmacs (it seems that ishl
-;; does not work).
-(cond
- (;; GNU Emacs 21 lazy highlighting
-  (fboundp 'isearch-lazy-highlight-search)
-
-  (defadvice isearch-lazy-highlight-search (around senator activate)
-    "Search ahead for the next or previous match, for lazy highlighting.
-Attempt to do the search exactly the way the pending isearch would."
-    (let ((case-fold-search isearch-case-fold-search))
-      (setq ad-return-value
-            (funcall (if isearch-search-handler-provider
-                         (funcall isearch-search-handler-provider)
-                       (isearch-default-search-handler))
-                     isearch-string
-                     (if isearch-forward
-                         (if isearch-lazy-highlight-wrapped
-                             isearch-lazy-highlight-start
-                           nil)
-                       (if isearch-lazy-highlight-wrapped
-                           isearch-lazy-highlight-end
-                         nil))
-                     t))))
-        
-  ;; Provide this function used by senator
-  (defun senator-lazy-highlight-update ()
-    "Force lazy highlight update."
-    (isearch-lazy-highlight-cleanup t)
-    (setq isearch-lazy-highlight-last-string nil)
-    (setq isearch-adjusted t)
-    (isearch-update))
-
-  ) ;; End of GNU Emacs 21 lazy highlighting
-
- (;; GNU Emacs 20 lazy highlighting (from ishl.el 1.5)
-  (condition-case nil
-      (require 'ishl)
-    (error nil))      
-       
-  (defadvice ishl-search (around senator activate)
-    (let ((case-fold-search isearch-case-fold-search))
-      (setq ad-return-value
-            (funcall (if isearch-search-handler-provider
-                         (funcall isearch-search-handler-provider)
-                       (isearch-default-search-handler))
-                     isearch-string
-                     (if isearch-forward
-                         (if ishl-wrapped ishl-start nil)
-                       (if ishl-wrapped ishl-end nil))
-                     t))))
-         
-  ;; Provide this function used by senator
-  (defun senator-lazy-highlight-update ()
-    "Force lazy highlight update."
-    (ishl-cleanup t)
-    (setq ishl-last-string nil)
-    (setq isearch-adjusted t)
-    (isearch-update))
-
-  ) ;; End of GNU Emacs 20 lazy highlighting
-
- (t ;; No lazy highlighting
-
-  ;; Ignore this function used by senator
-  (defalias 'senator-lazy-highlight-update 'ignore)
-
-  )
-      
- ) ;; End of isearch lazy highlight stuff
-
-(provide 'senator-isearch)
-
-;;; senator-isearch.el ends here

File lisp/senator.el

-;;; senator.el --- SEmantic NAvigaTOR
-
-;; Copyright (C) 2000 by David Ponce
-
-;; Author: David Ponce <david@dponce.com>
-;; Maintainer: David Ponce <david@dponce.com>
-;; Created: 10 Nov 2000
-;; Version: 2.1
-;; Keywords: tools, syntax
-;; VC: $Id$
-
-;; This file is not part of Emacs
-
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation; either version 2, or (at
-;; your option) any later version.
-
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING.  If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-;;
-;; This library defines commands and a minor mode to navigate between
-;; semantic language tokens in the current buffer.  It uses Eric Ludlam's
-;; Semantic Bovinator tool to parse the buffer and find the language
-;; tokens.
-
-;; The commands `senator-next-token' and `senator-previous-token'
-;; navigate respectively to the token after or before the point.  The
-;; command `senator-jump' directly jumps to a particular semantic
-;; symbol.
-
-;; Also, for each built-in search command `search-forward',
-;; `search-backward', `re-search-forward', `re-search-backward',
-;; `word-search-forward' and `word-search-backward', there is an
-;; equivalent `senator-<search-command>' defined which searches only
-;; in semantic token names.
-
-;; The command `senator-isearch-toggle-semantic-mode' toggles semantic
-;; search in isearch mode.  When semantic search is enabled, isearch
-;; is restricted to token names.
-
-;; Finally, the library provides a `senator-minor-mode' to easily
-;; enable or disable the SEmantic NAvigaTOR stuff for the current
-;; buffer.
-
-;; The best way to use navigation commands is to bind them to keyboard
-;; shortcuts.  Senator minor mode uses the common prefix key "C-c ,".
-;; The following default key bindings are provided when semantic minor
-;; mode is enabled:
-;;
-;;    key             binding
-;;    ---             -------
-;;    C-c , n         `senator-next-token'
-;;    C-c , p         `senator-previous-token'
-;;    C-c , j         `senator-jump'
-;;    C-c , i         `senator-isearch-toggle-semantic-mode'
-;;
-;; To install, put this file on your Emacs-Lisp load path and add
-;;   (require 'senator)
-;; into your ~/.emacs startup file.  To enable senator stuff in the
-;; current buffer use
-;;   (senator-minor-mode 1).
-
-;; You can customize the `senator-step-at-token-ids' to navigate (and
-;; search) only between tokens of a particular type.  (Such as
-;; functions and variables.)
-
-;; Customize `senator-step-at-start-end-token-ids' to stop at the
-;; start and end of the specified token types.
-
-;; To have a mode specific customization, do something like this in a hook:
-;;
-;; (add-hook 'mode-hook
-;;           (lambda ()
-;;             (setq senator-step-at-token-ids '(function variable))
-;;             (setq senator-step-at-start-end-token-ids '(function))
-;;             ))
-;;
-;; The above example specifies to navigate (and search) only between
-;; functions and variables, and to step at start and end of functions
-;; only.
-;;
-;; Any comments, suggestions, bug reports or upgrade requests are
-;; welcome.  Please send them to David Ponce at <david@dponce.com>
-
-;;; History:
-
-;; $Log$
-;; Revision 1.15  2001/01/03 16:09:28  david_ponce
-;; New version 2.1.
-;;
-;; Fixed a nasty typo in `senator-minor-mode'.  `run-hooks' were missing
-;; a quotation before their arguments.  Thanks to "Charles Rich"
-;; <rich@merl.com> who has reported this bug.
-;;
-;; Added new `senator-jump' command.  Thanks to "Eric M. Ludlam"
-;; <zappo@ultranet.com> and "T. V. Raman" <tvraman@almaden.ibm.com> for
-;; their help.
-;;
-;; Added new `senator-minor-mode-name' option to customize the name
-;; displayed in the modeline when senator minor mode is on.
-;;
-;; When semantic isearch mode is on it now appends "/si" to the senator
-;; minor mode name displayed in the modeline.
-;;
-;; Added new keyboard shortcut "\C-," to toggle semantic search in
-;; isearch mode.
-;;
-;; Some code improvements.
-;;
-;; Revision 1.14  2000/12/12 11:02:16  david_ponce
-;; `senator-mark-defun' now work on XEmacs too.
-;;
-;; Revision 1.13  2000/12/12 09:21:43  david_ponce
-;; Fixed a "side effect" bug with latest `beginning-of-defun' and
-;; `end-of-defun' advices.  They caused font-lock, which uses
-;; beginning/end of defun to force a reparse.  Thanks to "Eric M. Ludlam"
-;; <zappo@ultranet.com> for pointing this.
-;;
-;; Improved consistency with standard behaviour of `beginning-of-defun'
-;; (go to the beginning of the line where the defun starts) and
-;; `end-of-defun' (go to the beginning of the line following the end of
-;; the defun).
-;;
-;; Added useful advices for `narrow-to-defun', `mark-defun' and
-;; `c-mark-function'.
-;;
-;; Advices are enabled when the functions are called interactively and
-;; `senator-minor-mode' is enabled.
-;;
-;; Revision 1.12  2000/12/11 14:05:06  david_ponce
-;; Code cleanup and optimization.
-;; `senator-next-token' and `senator-previous-token' now correctly work
-;; when not binded to keyboard shortcuts.
-;; `beginning-of-defun' and `end-of-defun' advices no more need to be
-;; called interactively.  So `narrow-to-defun' can use these advices when
-;; `senator-minor-mode' is enabled.
-;;
-;; Revision 1.11  2000/12/11 07:07:09  david_ponce
-;; Applied Eric Ludlam's patch.  It adds a special face for senator to
-;; use for momentary highlight (requires latest semantic-util.el).  If
-;; the user cancels the parse (C-g) when `senator-minor-mode'
-;; initializes, it doesn't kill the rest of the configuration.  (Useful
-;; on a slow machine.)
-;;
-;; Revision 1.10  2000/12/08 16:18:32  david_ponce
-;; A bunch of XEmacs compatibility code!
-;;
-;; Revision 1.9  2000/12/07 09:20:21  david_ponce
-;; Applied Eric Ludlam's doc fix patch.
-;;
-;; Revision 1.8  2000/12/05 15:59:07  david_ponce
-;; Improved consistency with built-in search commands.
-;; New search commands like the ones in the Emacs Search menu.
-;; Added a menu to senator minor mode.
-;; The common prefix key in senator minor mode is now "C-c ,".
-;; Updated header comments.
-;; Some code cleanup.
-;;
-;; Revision 1.7  2000/12/05 11:13:19  david_ponce
-;; New major version 2.0 with [i]search feature and a senator minor mode.
-;; Added compatibility code between GNU Emacs 20.7 and 21.
-;;
-;; Revision 1.6  2000/11/28 12:44:47  david_ponce
-;; More performance improvements.
-;; New option `senator-highlight-found' to customize token highlighting.
-;;
-;; Revision 1.5  2000/11/27 13:24:17  david_ponce
-;; Fixed a serious performance problem in `senator-next-token' and
-;; `senator-previous-token'.
-;;
-;; Before searching for a next or previous token the point was just moved
-;; to respectively the next or previous character. Thus, during
-;; navigation, the buffer was explored character by character :-(.  Now
-;; `senator-next-token' and `senator-previous-token' skip whole tokens
-;; (unless they are 'type tokens which may include sub tokens).
-;;
-;; Revision 1.4  2000/11/14 17:23:21  david_ponce
-;; Minor change to `senator-next-token' and `senator-previous-token' to
-;; return the token at point.  Useful when calling these commands
-;; non-interactively.
-;;
-;; Revision 1.3  2000/11/14 13:04:26  david_ponce
-;; Improved navigation in semantic token where to step at start and end.
-;;
-;; - `senator-next-token' move the point to the end of token if it was at
-;;   beginning or in the middle of the token.
-;;
-;; - `senator-previous-token' move the point to the beginning of token if
-;;   it was at end or in the middle of the token.
-;;
-;; Revision 1.2  2000/11/10 17:11:15  david_ponce
-;; Fixed a little bug in `senator-previous-token' navigation.
-;;
-;; Revision 1.1  2000/11/10 16:04:20  david_ponce
-;; Initial revision.
-;;
-
-;;; Code:
-(require 'semantic)
-(require 'senator-isearch)       ; Needed isearch advices
-
-(defgroup senator nil
-  "SEmantic NAvigaTOR."
-  :group 'semantic)
-
-(defcustom senator-minor-mode-name "Senator"
-  "*Name displayed in the modeline when senator minor mode is on."
-  :group 'senator
-  :type 'string)
-
-(defface senator-momentary-highlight-face  '((((class color) (background dark))
-					      (:background "gray30"))
-					     (((class color) (background light))
-					      (:background "gray70")))
-  "Face used to momentarilly highlight tokens."
-  :group 'senator)
-
-(defcustom senator-step-at-token-ids nil
-  "*List of token identifiers where to step.
-Token identifier is symbol 'variable, 'function, 'type, or other.  If
-nil navigation steps at any token found.  This is a buffer local
-variable.  It can be set in a mode hook to get a specific langage
-navigation."
-  :group 'senator
-  :type '(repeat (symbol)))
-(make-variable-buffer-local 'senator-step-at-token-ids)
-
-(defcustom senator-step-at-start-end-token-ids '(function)
-  "*List of token identifiers where to step at start and end.
-Token identifier is symbol 'variable, 'function, 'type, or other.  If
-nil navigation only step at beginning of tokens.  This is a buffer
-local variable.  It can be set in a mode hook to get a specific
-langage navigation."
-  :group 'senator
-  :type '(repeat (symbol)))
-(make-variable-buffer-local 'senator-step-at-start-end-token-ids)
-
-(defcustom senator-highlight-found t
-  "*If non-nil highlight tokens found.
-This option requires semantic 1.3 and above.  This is a buffer
-local variable.  It can be set in a mode hook to get a specific
-langage behaviour."
-  :group 'senator
-  :type 'boolean)
-(make-variable-buffer-local 'senator-highlight-found)
-
-(defcustom senator-separator-char ?#
-  "*Character separator used to compose token full name."
-  :group 'senator
-  :type 'character)
-(make-variable-buffer-local 'senator-separator-char)
-
-;;; Compatibility
-(cond ((fboundp 'semantic-momentary-highlight-token)
-       ;; semantic 1.3
-       (defun senator-parse ()
-         "Parse the current buffer and return the tokens where to navigate."
-         (semantic-bovinate-toplevel t))
-       )
-      (t
-       ;; semantic before 1.3
-       (defun semantic-momentary-highlight-token (&rest ignore)
-         "Highlight a token, removing highlighting when the user hits a key.
-Not implemented in this version of the Semantic Bovinator.  IGNORE
-arguments and always return nil."
-         nil)
-       (defun semantic-find-nonterminal-by-overlay (&rest ignore)
-         "Find all nonterminals covering a position by using overlays.
-Not implemented in this version of the Semantic Bovinator.  IGNORE
-arguments and always return nil."
-         nil)
-       (defun senator-parse ()
-         "Parse the current buffer and return the tokens where to navigate."
-         (semantic-bovinate-toplevel nil nil t))
-       ))
-
-;;;;
-;;;; Common functions
-;;;;
-
-(defun senator-momentary-highlight-token (token)
-  "Momentary highlight TOKEN.
-Does nothing if `senator-highlight-found' is nil or semantic version
-is bellow 1.3."
-  (and senator-highlight-found
-       (condition-case nil
- 	   (semantic-momentary-highlight-token
-	    token 'senator-momentary-highlight-face)
-	 (error (semantic-momentary-highlight-token token)))))
-
-(defun senator-message (&rest args)
-  "Call function `message' with ARGS without logging."
-  (let (message-log-max)
-    (apply 'message args)))
-
-(defun senator-step-at-start-end-p (token)
-  "Return non-nil if must step at start and end of TOKEN."
-  (if token
-      (let ((categ (semantic-token-token token)))
-        (and (not (eq categ 'type))
-             (memq categ senator-step-at-start-end-token-ids)))))
-
-(defun senator-skip-p (token)
-  "Return non-nil if must skip TOKEN."
-  (and token
-       senator-step-at-token-ids
-       (not (memq (semantic-token-token token)
-                  senator-step-at-token-ids))))
-
-(defun senator-find-token-before (tokens pos comp &optional prev)
-  "Visit TOKENS and return the last one found at or before POS.
-COMP is the function used to compare a current visited token start
-position to POS.  That is `>=' to return the token before POS or `>'
-to return the token at or before POS.  PREV is the last token found or
-nil."
-  (let (token)
-    (while tokens
-      (setq token (car tokens))
-      (if (funcall comp (semantic-token-start token) pos)
-          (throw 'found prev))
-      (or (senator-skip-p token)
-          (setq prev token))
-      (if (eq (semantic-token-token token) 'type)
-          (setq prev (senator-find-token-before
-                      (semantic-token-type-parts token) pos comp prev)))
-      (setq tokens (cdr tokens)))
-    prev))
-
-(defun senator-find-previous-token (tokens pos)
-  "Visit TOKENS and return the token before POS."
-  (catch 'found (senator-find-token-before tokens pos #'>=)))
-
-(defun senator-find-last-token (tokens pos)
-  "Visit TOKENS and return the token at or before POS."
-  (catch 'found (senator-find-token-before tokens pos #'>)))
-
-(defun senator-find-next-token (tokens pos)
-  "Visit TOKENS and return the token after POS."
-  (let (token found)
-    (while (and tokens (not found))
-      (setq token (car tokens))
-      (if (and (not (senator-skip-p token))
-               (or (and (senator-step-at-start-end-p token)
-                        (> (semantic-token-end token) pos))
-                   (> (semantic-token-start token) pos)))
-          (setq found token)
-        (if (eq (semantic-token-token token) 'type)
-            (setq found (senator-find-next-token
-                         (semantic-token-type-parts token) pos))))
-      (setq tokens (cdr tokens)))
-    found))
-
-(defun senator-middle-of-token-p (pos token)
-  "Return non-nil if POS is between start and end of TOKEN."
-  (and (> pos (semantic-token-start token))
-       (< pos (semantic-token-end   token))))
-
-(defun senator-full-token-name (token parent)
-  "Compose a full name from TOKEN name and names in its PARENT list.
-A `senator-separator-char' separates each token name.  The parent list
-is in reverse order."
-  (let ((sep  (char-to-string senator-separator-char))
-        (name ""))
-    (while parent
-      (setq name (concat (semantic-token-name (car parent))
-                         sep
-                         name)
-            parent (cdr parent)))
-    (concat name (semantic-token-name token))))
-
-(defun senator-last-name (full-name)
-  "Return the last name from FULL-NAME.
-That is the name after the last `senator-separator-char' or FULL-NAME
-itself if it does not contain any separator character."
-  (and (string-match (format "[%c]?\\([^%c]+\\)\\'"
-                             senator-separator-char
-                             senator-separator-char)
-                     full-name)
-       (match-string 1 full-name)))
-
-(defun senator-completion-stream (stream parent full-name-p &optional top-level)
-  "Return a useful completion list from STREAM.
-That is a flat list of all tokens available.  Prepend to each token
-name the name of tokens in its PARENT list if FULL-NAME-P is non-nil.
-This helps to distinguish between tokens in multiple top level type
-declarations or in sub type declarations.  If TOP-LEVEL is non-nil the
-completion list will contain only tokens at top level.  Otherwise all
-sub type tokens are included too."
-  (let (cs token)
-    (while stream
-      (setq token  (car stream))
-      (setq stream (cdr stream))
-      (setq cs (cons (cons (senator-full-token-name token parent)
-                           (cdr token))
-                     cs))
-      (and (not top-level)
-           (eq (semantic-token-token token) 'type)
-           (setq cs (append cs (senator-completion-stream
-                                (semantic-token-type-parts token)
-                                (and full-name-p (cons token parent))
-                                t)))))
-    cs))
-
-(defun senator-current-type-context ()
-  "Return tokens in the type context at point or nil if not found."
-  (let ((context (semantic-find-nonterminal-by-token
-                  'type (semantic-find-nonterminal-by-overlay))))
-    (if context
-        (semantic-token-type-parts
-         (nth (1- (length context)) context)))))
-
-(defun senator-completion-list (&optional in-context)
-  "Return a useful completion list from tokens in current buffer.
-That is a flat list of all tokens available.  If IN-CONTEXT is not nil
-return only the top level tokens in the type context at point or the
-top level tokens in the current buffer if no type context exists at
-point."
-  (let (stream full-name-p)
-    (if in-context
-        (setq stream (senator-current-type-context)))
-    (or stream (setq stream (senator-parse)))
-    (setq full-name-p (and (not in-context)
-                           (cdr (semantic-find-nonterminal-by-token
-                                 'type stream))))
-    (senator-completion-stream stream nil full-name-p in-context)))
-
-;;;;
-;;;; Search functions
-;;;;
-
-(defun senator-search-token-name (token)
-  "Search the TOKEN name in TOKEN bounds.
-Set point to the end of the name, and return point.  To get the
-beginning of the name use (match-beginning 0)."
-  (let ((name (semantic-token-name token)))
-    (goto-char (semantic-token-start token))
-    (re-search-forward (concat
-                        "\\b"
-                        (regexp-quote
-                         (if (string-match "\\`\\([^[]+\\)[[]" name)
-                             (match-string 1 name)
-                           name)))
-                       (semantic-token-end token))))
-
-(defun senator-search-forward-raw (searcher what &optional bound noerror count)
-  "Use SEARCHER to search WHAT in semantic tokens after point.
-See `search-forward' for the meaning of BOUND NOERROR and COUNT.
-BOUND and COUNT are just ignored in the current implementation."
-  (let ((origin (point))
-        (tokens (senator-parse))
-        (senator-step-at-start-end-token-ids nil)
-        token pos start limit)
-    (save-excursion
-      (setq token (or (senator-find-last-token tokens origin)
-                      (senator-find-next-token tokens origin)))
-      (while (and token (not pos))
-        (setq limit (senator-search-token-name token))
-        (setq start (match-beginning 0))
-        (if (and (> origin start) (< origin limit))
-            (setq start origin))
-        (goto-char start)
-        (setq pos (funcall searcher what limit t))
-        (if (and pos (>= (match-beginning 0) origin))
-            nil
-          (setq pos nil)
-          (setq token (senator-find-next-token tokens (point))))))
-    (if pos
-        (goto-char start)
-      (setq limit (point)))
-    (funcall searcher what limit noerror)))
-
-(defun senator-search-backward-raw (searcher what &optional bound noerror count)
-  "Use SEARCHER to search WHAT in semantic tokens before point.
-See `search-backward' for the meaning of BOUND NOERROR and
-COUNT.  BOUND and COUNT are just ignored in the current
-implementation."
-  (let ((origin (point))
-        (tokens (senator-parse))
-        (senator-step-at-start-end-token-ids nil)
-        token pos start limit)
-    (save-excursion
-      (setq token (senator-find-previous-token tokens origin))
-      (while (and token (not pos))
-        (setq start (senator-search-token-name token))
-        (setq limit (match-beginning 0))
-        (if (and (< origin start) (> origin limit))
-            (setq start origin))
-        (goto-char start)
-        (setq pos (funcall searcher what limit t))
-        (if (and pos (<= (match-end 0) origin))
-            nil
-          (setq pos nil)
-          (goto-char (semantic-token-start token))
-          (setq token (senator-find-previous-token tokens (point))))))
-    (if pos
-        (goto-char start)
-      (setq limit (point)))
-    (funcall searcher what limit noerror)))
-
-;;;;
-;;;; Navigation commands
-;;;;
-
-;;;###autoload
-(defun senator-next-token ()
-  "Navigate to the next semantic token.
-Return the semantic token or nil if at end of buffer."
-  (interactive)
-  (let ((pos    (point))
-        (tokens (senator-parse))
-        found where)
-    (setq found (senator-find-next-token tokens (point)))
-    (if (not found)
-        (progn
-          (goto-char (point-max))
-          (senator-message "End of buffer"))
-      (cond ((and (senator-step-at-start-end-p found)
-                  (or (= pos (semantic-token-start found))
-                      (senator-middle-of-token-p pos found)))
-             (setq where "end")
-             (goto-char (semantic-token-end found)))
-            (t
-             (setq where "start")
-             (goto-char (semantic-token-start found))))
-      (senator-momentary-highlight-token found)
-      (senator-message "%S: %s (%s)"
-                       (semantic-token-token found)
-                       (semantic-token-name  found)
-                       where))
-    found))
-
-;;;###autoload
-(defun senator-previous-token ()
-  "Navigate to the previous semantic token.
-Return the semantic token or nil if at beginning of buffer."
-  (interactive)
-  (let ((pos    (point))
-        (tokens (senator-parse))
-        found where)
-    (setq found (senator-find-previous-token tokens (point)))
-    (if (not found)
-        (progn
-          (goto-char (point-min))
-          (senator-message "Beginning of buffer"))
-      (cond ((or (not (senator-step-at-start-end-p found))
-                 (= pos (semantic-token-end found))
-                 (senator-middle-of-token-p pos found))
-             (setq where "start")
-             (goto-char (semantic-token-start found)))
-            (t
-             (setq where "end")
-             (goto-char (semantic-token-end found))))
-      (senator-momentary-highlight-token found)
-      (senator-message "%S: %s (%s)"
-                       (semantic-token-token found)
-                       (semantic-token-name  found)
-                       where))
-    found))
-
-;;;###autoload
-(defun senator-jump (sym)
-  "Jump to the semantic symbol SYM.
-If called interactively and a prefix argument is supplied jump in the
-local type's context (see function `senator-current-type-context')."
-  (interactive
-   (list
-    (completing-read "Jump to: "
-                     (senator-completion-list current-prefix-arg)
-                     nil
-                     t
-                     ""
-                     'semantic-read-symbol-history)))
-  (when sym
-    (let ((token
-           (semantic-find-nonterminal-by-name (senator-last-name sym)
-                                              (current-buffer))))
-      (goto-char (semantic-token-start  token))
-      (senator-momentary-highlight-token token)
-      (senator-message "%S: %s "
-                       (semantic-token-token token)
-                       (semantic-token-name  token)))))
-
-;;;;
-;;;; Search commands
-;;;;
-
-;;;###autoload
-(defun senator-search-forward (what &optional bound noerror count)
-  "Search semantic tokens forward from point for string WHAT.
-Set point to the end of the occurrence found, and return point.  See
-`search-forward' for details and the meaning of BOUND NOERROR and
-COUNT.  BOUND and COUNT are just ignored in the current
-implementation."
-  (interactive "sSemantic search: ")
-  (senator-search-forward-raw #'search-forward what bound noerror count))
-
-;;;###autoload
-(defun senator-re-search-forward (what &optional bound noerror count)
-  "Search semantic tokens forward from point for regexp WHAT.
-Set point to the end of the occurrence found, and return point.  See
-`re-search-forward' for details and the meaning of BOUND NOERROR and
-COUNT.  BOUND and COUNT are just ignored in the current
-implementation."
-  (interactive "sSemantic regexp search: ")
-  (senator-search-forward-raw #'re-search-forward what bound noerror count))
-
-;;;###autoload
-(defun senator-word-search-forward (what &optional bound noerror count)
-  "Search semantic tokens forward from point for word WHAT.
-Set point to the end of the occurrence found, and return point.  See
-`word-search-forward' for details and the meaning of BOUND NOERROR and
-COUNT.  BOUND and COUNT are just ignored in the current
-implementation."
-  (interactive "sSemantic word search: ")
-  (senator-search-forward-raw #'word-search-forward what bound noerror count))
-
-;;;###autoload
-(defun senator-search-backward (what &optional bound noerror count)
-  "Search semantic tokens backward from point for string WHAT.
-Set point to the beginning of the occurrence found, and return point.
-See `search-backward' for details and the meaning of BOUND NOERROR and
-COUNT.  BOUND and COUNT are just ignored in the current
-implementation."
-  (interactive "sSemantic backward search: ")
-  (senator-search-backward-raw #'search-backward what bound noerror count))
-
-;;;###autoload
-(defun senator-re-search-backward (what &optional bound noerror count)
-  "Search semantic tokens backward from point for regexp WHAT.
-Set point to the beginning of the occurrence found, and return point.
-See `re-search-backward' for details and the meaning of BOUND NOERROR
-and COUNT.  BOUND and COUNT are just ignored in the current
-implementation."
-  (interactive "sSemantic backward regexp search: ")
-  (senator-search-backward-raw #'re-search-backward what bound noerror count))
-
-;;;###autoload
-(defun senator-word-search-backward (what &optional bound noerror count)
-  "Search semantic tokens backward from point for word WHAT.
-Set point to the beginning of the occurrence found, and return point.
-See `word-search-backward' for details and the meaning of BOUND
-NOERROR and COUNT.  BOUND and COUNT are just ignored in the current
-implementation."
-  (interactive "sSemantic backward word search: ")
-  (senator-search-backward-raw #'word-search-backward what bound noerror count))
-
-;;;;
-;;;; Others useful search commands (minor mode menu)
-;;;;
-
-(defun senator-nonincremental-search-forward (string)
-  "Search for STRING  nonincrementally."
-  (interactive "sSemantic search for string: ")
-  (if (equal string "")
-      (senator-search-forward (car search-ring))
-    (isearch-update-ring string nil)
-    (senator-search-forward string)))
-
-(defun senator-nonincremental-search-backward (string)
-  "Search backward for STRING nonincrementally."
-  (interactive "sSemantic search for string: ")
-  (if (equal string "")
-      (senator-search-backward (car search-ring))
-    (isearch-update-ring string nil)
-    (senator-search-backward string)))
-
-(defun senator-nonincremental-re-search-forward (string)
-  "Search for the regular expression STRING nonincrementally."
-  (interactive "sSemantic search for regexp: ")
-  (if (equal string "")
-      (senator-re-search-forward (car regexp-search-ring))
-    (isearch-update-ring string t)
-    (senator-re-search-forward string)))
-
-(defun senator-nonincremental-re-search-backward (string)
-  "Search backward for the regular expression STRING nonincrementally."
-  (interactive "sSemantic search for regexp: ")
-  (if (equal string "")
-      (senator-re-search-backward (car regexp-search-ring))
-    (isearch-update-ring string t)
-    (senator-re-search-backward string)))
-
-(defun senator-nonincremental-repeat-search-forward ()
-  "Search forward for the previous search string."
-  (interactive)
-  (if (null search-ring)
-      (error "No previous search"))
-  (senator-search-forward (car search-ring)))
-
-(defun senator-nonincremental-repeat-search-backward ()
-  "Search backward for the previous search string."
-  (interactive)
-  (if (null search-ring)
-      (error "No previous search"))
-  (senator-search-backward (car search-ring)))
-
-(defun senator-nonincremental-repeat-re-search-forward ()
-  "Search forward for the previous regular expression."
-  (interactive)
-  (if (null regexp-search-ring)
-      (error "No previous search"))
-  (senator-re-search-forward (car regexp-search-ring)))
-
-(defun senator-nonincremental-repeat-re-search-backward ()
-  "Search backward for the previous regular expression."
-  (interactive)
-  (if (null regexp-search-ring)
-      (error "No previous search"))
-  (senator-re-search-backward (car regexp-search-ring)))
-
-;;;;
-;;;; Senator minor mode
-;;;;
-(defvar senator-mode nil
-  "Name of the minor mode, if non-nil.")
-(make-variable-buffer-local 'senator-mode)
-
-(defvar senator-isearch-semantic-mode nil
-  "Non-nil if isearch does semantic search.
-This is a buffer local variable.")
-(make-variable-buffer-local 'senator-isearch-semantic-mode)
-
-(defvar senator-prefix-key [(control ?c) ?,]
-  "The common prefix key in senator minor mode.")
-
-(defvar senator-prefix-map
-  (let ((km (make-sparse-keymap)))
-    (define-key km "i" 'senator-isearch-toggle-semantic-mode)
-    (define-key km "j" 'senator-jump)
-    (define-key km "p" 'senator-previous-token)
-    (define-key km "n" 'senator-next-token)
-    km)
-  "Default key bindings in senator minor mode.")
-
-(defun senator-menu-item (item)
-  "Build an XEmacs compatible menu item from vector ITEM.
-That is remove the unsupported :help stuff."
-  (if (featurep 'xemacs)
-      (let ((n (length item))
-            (i 0)
-            l)
-        (while (< i n)
-          (setq slot (aref item i))
-          (if (and (keywordp slot)
-                   (eq slot :help))
-              (setq i (1+ i))
-            (setq l (cons slot l)))
-          (setq i (1+ i)))
-        (apply #'vector (nreverse l)))
-    item))
-
-(defvar senator-menu-bar
-  (list
-   "Senator"
-   (list
-    "Navigate"
-    (senator-menu-item
-     ["Next"
-      senator-next-token
-      :active t
-      :help "Go to the next token found"
-      ])
-    (senator-menu-item
-     ["Previous"
-      senator-previous-token
-      :active t
-      :help "Go to the previous token found"
-      ])
-    (senator-menu-item
-     ["Jump..."
-      senator-jump
-      :active t
-      :help "Jump to a semantic symbol"
-      ])
-    )
-   (list
-    "Search"
-    (senator-menu-item
-     ["Search..."
-      senator-nonincremental-search-forward
-      :active t
-      :help "Search forward for a string"
-      ])
-    (senator-menu-item
-     ["Search Backwards..."
-      senator-nonincremental-search-backward
-      :active t
-      :help "Search backwards for a string"
-      ])
-    (senator-menu-item
-     ["Repeat Search"
-      senator-nonincremental-repeat-search-forward
-      :active search-ring
-      :help "Repeat last search forward"
-      ])
-    (senator-menu-item
-     ["Repeat Backwards"
-      senator-nonincremental-repeat-search-backward
-      :active search-ring
-      :help "Repeat last search backwards"
-      ])
-    (senator-menu-item
-     ["Search Regexp..."
-      senator-nonincremental-re-search-forward
-      :active t
-      :help "Search forward for a regular expression"
-      ])
-    (senator-menu-item
-     ["Search Regexp Backwards..."
-      senator-nonincremental-re-search-backward
-      :active t
-      :help "Search backwards for a regular expression"
-      ])
-    (senator-menu-item
-     ["Repeat Regexp"
-      senator-nonincremental-repeat-re-search-forward
-      :active regexp-search-ring
-      :help "Repeat last regular expression search forward"
-      ])
-    (senator-menu-item
-     ["Repeat Regexp Backwards"
-      senator-nonincremental-repeat-re-search-backward
-      :active regexp-search-ring
-      :help "Repeat last regular expression search backwards"
-      ])
-    "-"
-    (senator-menu-item
-     ["Semantic isearch mode"
-      senator-isearch-toggle-semantic-mode
-      :active t
-      :style toggle :selected senator-isearch-semantic-mode
-      :help "Toggle semantic search in isearch mode"
-      ])
-    )
-   "-"
-   (senator-menu-item
-    ["Options..."
-     (customize-group "senator")
-     :active t
-     :help "Customize SEmantic NAvigaTOR options"
-     ])
-   )
-  "Menu for senator minor mode.")
-
-(defvar senator-mode-map
-  (let ((km (make-sparse-keymap)))
-    (define-key km senator-prefix-key senator-prefix-map)
-    (easy-menu-define senator-minor-menu km "Senator Minor Mode Menu"
-                      senator-menu-bar)
-    km)
-  "Keymap for senator minor mode.")
-
-(defun senator-show-status ()
-  "Update the modeline to show the senator minor mode state.
-If `senator-isearch-semantic-mode' is non-nil append \"/si\" to
-the value of the variable `senator-minor-mode-name'."
-  (setq senator-mode (format (if senator-isearch-semantic-mode
-                                 " %s/si"
-                               " %s")
-                             senator-minor-mode-name))
-  (force-mode-line-update))
-
-(defun senator-minor-mode-setup ()
-  "Actually setup the senator minor mode.
-Turn off the minor mode if semantic feature is not available or
-`semantic-toplevel-bovine-table' not provided for the current buffer.
-If minor mode is enabled parse the current buffer if needed.  Return
-non-nil if the minor mode is enabled."
-  (if senator-minor-mode
-      (if (not (and (featurep 'semantic) semantic-toplevel-bovine-table))
-          ;; Disable minor mode if semantic stuff not available
-          (senator-minor-mode nil)
-        ;; XEmacs needs this
-        (if (featurep 'xemacs)
-            (easy-menu-add senator-minor-menu senator-mode-map))
-        ;; Parse the current buffer if needed
-	(condition-case nil
-	    (senator-parse)
-	  (quit (message "senator-minor-mode: parsing of buffer canceled.")))
-        (senator-show-status)
-        )
-    ;; XEmacs needs this
-    (if (featurep 'xemacs)
-        (easy-menu-remove senator-minor-menu))
-    ;; Disable semantic isearch
-    (setq senator-isearch-semantic-mode nil))
-  senator-minor-mode)
-  
-(if (fboundp 'define-minor-mode)
-
-;;; Note that `define-minor-mode' actually calls the mode-function if
-;;; the associated variable is non-nil, which requires that all needed
-;;; functions be already defined.  [This is arguably a bug in d-m-m]
-;;;###autoload
-    (define-minor-mode senator-minor-mode
-      "Toggle senator minor mode.
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode is turned on only if semantic feature is available and a
-`semantic-toplevel-bovine-table' is provided for the current buffer.
-Return non-nil if the minor mode is enabled.
-
-\\{senator-mode-map}"
-      nil senator-mode senator-mode-map
-      :global nil
-      :group 'senator
-      (senator-minor-mode-setup))
-
-;;; `define-minor-mode' is not defined
-
-  (defvar senator-minor-mode nil
-    "Non-nil if senator minor mode is on.")
-  (make-variable-buffer-local 'senator-minor-mode)
-  
-  (defvar senator-minor-mode-hook  nil
-    "Hook called when senator minor mode is toggled")
-  
-  (defvar senator-minor-mode-on-hook nil
-    "Hook called when senator minor mode is turned on")
-  
-  (defvar senator-minor-mode-off-hook nil
-    "Hook called when senator minor mode is turned off")
-  
-;;;###autoload
-  (defun senator-minor-mode (&optional arg)
-      "Toggle senator minor mode.
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode is turned on only if semantic feature is available and a
-`semantic-toplevel-bovine-table' is provided for the current buffer.
-Return non-nil if the minor mode is enabled.
-
-\\{senator-mode-map}"
-    (interactive "P")
-    (let ((old-mode senator-minor-mode))
-      (setq senator-minor-mode
-            (if arg
-                (or (listp arg) ;; C-u alone
-                    (> (prefix-numeric-value arg) 0))
-              (not senator-minor-mode)))
-      (and senator-minor-mode-hook
-           (not (equal old-mode senator-minor-mode))
-           (run-hooks 'senator-minor-mode-hook))
-      (and senator-minor-mode-on-hook
-           senator-minor-mode
-           (run-hooks 'senator-minor-mode-on-hook))
-      (and senator-minor-mode-off-hook
-           (not senator-minor-mode)
-           (run-hooks 'senator-minor-mode-off-hook)))
-    (senator-minor-mode-setup)
-    (senator-message "Senator minor mode %s"
-                     (if senator-minor-mode
-                         "enabled"
-                       "disabled"))
-    senator-minor-mode)
-
-  (if (fboundp 'add-minor-mode)
-      
-      ;; XEmacs
-      (add-minor-mode 'senator-minor-mode 'senator-mode senator-mode-map)
-
-    ;; Emacs 20
-    (or (assq 'senator-minor-mode minor-mode-alist)
-        (setq minor-mode-alist
-              (cons (list 'senator-minor-mode 'senator-mode) minor-mode-alist)))
-    
-    (or (assq 'senator-minor-mode minor-mode-map-alist)
-        (setq minor-mode-map-alist
-              (cons (cons 'senator-minor-mode senator-mode-map)
-                    minor-mode-map-alist)))
-    
-    ))
-
-;;;;
-;;;; Useful advices
-;;;;
-
-(defun senator-beginning-of-defun ()
-  "Move backward to the beginning of a defun.
-Use semantic tokens to navigate."
-  (let ((senator-highlight-found nil)
-        (senator-step-at-start-end-token-ids nil)
-        (senator-step-at-token-ids '(function)))
-    (if (senator-previous-token)
-        (beginning-of-line))
-    (senator-message nil)))
-
-(defun senator-end-of-defun ()
-  "Move forward to next end of defun.
-Use semantic tokens to navigate."
-  (let* ((senator-highlight-found nil)
-         (senator-step-at-start-end-token-ids '(function))
-         (senator-step-at-token-ids '(function))
-         (token (senator-next-token)))
-    (when token
-      (if (= (point) (semantic-token-start token))
-          (goto-char (semantic-token-end token)))
-      (skip-chars-forward " \t")
-      (if (looking-at "\\s<\\|\n")
-          (forward-line 1)))
-    (senator-message nil)))
-
-(defun senator-narrow-to-defun ()
-  "Make text outside current defun invisible.
-The defun visible is the one that contains point or follows point.
-Use semantic tokens to navigate."
-  (interactive)
-  (save-excursion
-    (widen)
-    (senator-end-of-defun)
-    (let ((end (point)))
-      (senator-beginning-of-defun)
-      (narrow-to-region (point) end))))
-
-(defun senator-mark-defun ()
-  "Put mark at end of this defun, point at beginning.
-The defun marked is the one that contains point or follows point.
-Use semantic tokens to navigate."
-  (interactive)
-  (let ((origin (point))
-	(end    (progn (senator-end-of-defun) (point)))
-	(start  (progn (senator-beginning-of-defun) (point))))
-    (goto-char origin)
-    (push-mark (point))
-    (goto-char end) ;; end-of-defun
-    (push-mark (point) nil t)
-    (goto-char start) ;; beginning-of-defun
-    (re-search-backward "^\n" (- (point) 1) t)))
-
-(defadvice beginning-of-defun (around senator activate)
-  "Move backward to the beginning of a defun.
-If semantic tokens are available, use them to navigate."
-  (if (and senator-minor-mode (interactive-p))
-      (senator-beginning-of-defun)
-    ad-do-it))
-
-(defadvice end-of-defun (around senator activate)
-  "Move forward to next end of defun.
-If semantic tokens are available, use them to navigate."
-  (if (and senator-minor-mode (interactive-p))
-      (senator-end-of-defun)
-    ad-do-it))
-
-(defadvice narrow-to-defun (around senator activate)
-  "Make text outside current defun invisible.
-The defun visible is the one that contains point or follows point.
-If semantic tokens are available, use them to navigate."
-  (if (and senator-minor-mode (interactive-p))
-      (senator-narrow-to-defun)
-    ad-do-it))
-
-(defadvice mark-defun (around senator activate)
-  "Put mark at end of this defun, point at beginning.
-The defun marked is the one that contains point or follows point.
-If semantic tokens are available, use them to navigate."
-  (if (and senator-minor-mode (interactive-p))
-      (senator-mark-defun)
-    ad-do-it))
-
-(defadvice c-mark-function (around senator activate)
-  "Put mark at end of this defun, point at beginning.
-The defun marked is the one that contains point or follows point.
-If semantic tokens are available, use them to navigate."
-  (if (and senator-minor-mode (interactive-p))
-      (senator-mark-defun)
-    ad-do-it))
-
-;;;;
-;;;; Using semantic search in isearch mode
-;;;;
-
-(defun senator-isearch-search-handler ()
-  "Return the actual search function used by `isearch-search'.
-If `senator-isearch-semantic-mode' is nil it delegates to the
-function `isearch-default-search-handler'.  Otherwise it returns one
-of the functions `senator-search-forward', `senator-search-backward',
-`senator-word-search-forward', `senator-word-search-backward',
-`senator-re-search-forward' or `senator-re-search-backward' depending
-on current values of the variables `isearch-forward', `isearch-regexp'
-and `isearch-word'."
-  (if senator-isearch-semantic-mode
-      (cond (isearch-word
-             (if isearch-forward
-                 'senator-word-search-forward
-               'senator-word-search-backward))
-            (isearch-regexp
-             (if isearch-forward
-                 'senator-re-search-forward
-               'senator-re-search-backward))
-            (t
-             (if isearch-forward
-                 'senator-search-forward
-               'senator-search-backward)))
-    (isearch-default-search-handler)))
-
-(defun senator-isearch-toggle-semantic-mode ()
-  "Toggle semantic searching on or off in isearch mode.
-\\[senator-isearch-toggle-semantic-mode] toggle semantic searching."
-  (interactive)
-  (when senator-minor-mode
-    (setq senator-isearch-semantic-mode
-          (not senator-isearch-semantic-mode))
-    (senator-show-status)
-    (if isearch-mode
-        ;; force lazy highlight update
-        (senator-lazy-highlight-update)
-      (senator-message "Isearch semantic mode %s"
-                       (if senator-isearch-semantic-mode
-                           "enabled"
-                         "disabled")))))
-
-;; Needed by XEmacs isearch to not terminate isearch mode when
-;; toggling semantic search.
-(put 'senator-isearch-toggle-semantic-mode 'isearch-command t)
-
-;; Keyboard shortcut to toggle semantic search in isearch mode.
-(define-key isearch-mode-map [(control ?,)] 'senator-isearch-toggle-semantic-mode)
-
-(defun senator-isearch-mode-hook ()
-  "Isearch mode hook to setup semantic searching."
-  (setq isearch-search-handler-provider #'senator-isearch-search-handler)
-  (or senator-minor-mode
-      (setq senator-isearch-semantic-mode nil))
-  (senator-show-status))
-
-(add-hook 'isearch-mode-hook 'senator-isearch-mode-hook)
-
-(provide 'senator)
-
-;;; senator.el ends here

File lisp/setnu.el

-;;; This works better under XEmacs, because it can use the left
-;;; margin for the line number glyphs, but it will work under Emacs
-;;; also.
-
-;;; vi-style line number mode for Emacs
-;;; (requires Emacs 19.29 or later, or XEmacs 19.11 or later)
-;;; Copyright (C) 1994, 1995, 1997 Kyle E. Jones
-;;;
-;;; This program is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; A copy of the GNU General Public License can be obtained from this
-;;; program's author (send electronic mail to kyle@uunet.uu.net) or from
-;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
-;;; 02139, USA.
-;;;
-;;; Send bug reports to kyle@wonderworks.com
-;;
-;; M-x setnu-mode toggles the line number mode on and off.
-;;
-;; turn-on-setnu-mode is useful for adding to a major-mode hook
-;; variable.
-;; Example:
-;;     (add-hook 'text-mode-hook 'turn-on-setnu-mode)
-;; to automatically turn on line numbering when enterting text-mode."
-
-(provide 'setnu)
-
-(defconst setnu-running-under-xemacs
-  (or (string-match "XEmacs" emacs-version)
-      (string-match "Lucid" emacs-version)))
-
-(defconst setnu-mode-version "1.05"
-  "Version number for this release of setnu-mode.")
-
-(defvar setnu-mode nil
-  "Non-nil if setnu-mode is active in the current buffer.")
-(make-variable-buffer-local 'setnu-mode)
-
-(defvar setnu-start-extent nil
-  "First extent of a chain of extents used by setnu-mode.
-Each line has its own extent.  Each line extent has a
-`setnu-next-extent' property that points to the next extent in
-the chain, which is the extent for the next line in the buffer.
-There is also a `setnu-prev-extent' that points at the previous
-extent in the chain.  To distinguish them from other extents the
-setnu-mode extents all have a non-nil `setnu' property.")
-(make-variable-buffer-local 'setnu-start-extent)
-
-(defvar setnu-glyph-obarray (make-vector 401 0)
-  "Obarray of symbols whose values are line number glyphs.
-Each symbol name is the string represnetation of a number, perhaps
-passed with spaces.  The value of the symbol is a glyph that can
-be made the begin glyph of an extent to display as a line number.")
-
-(defvar setnu-begin-glyph-property (if (fboundp 'extent-property)
-                       'begin-glyph
-                     'before-string)
-  "Property name to use to set the begin glyph of an extent.")
-
-(defvar setnu-line-number-format (if setnu-running-under-xemacs "%4d" "%4d  ")
-  "String suitable for `format' that will generate a line number string.
-`format' will be called with this string and one other argument
-which will be an integer, the line number.")
-
-(defvar setnu-line-number-face 'bold
-  "*Face used to display the line numbers.
-Currently this works for XEmacs 19.12 and later versions only.")
-
-(defun setnu-mode (&optional arg)
-  "Toggle setnu-mode.
-With prefix argument, turn setnu-mode on if argument is positive.
-When setnu-mode is enabled, a line number will appear at the left
-margin of each line."
-  (interactive "P")
-  (let ((oldmode (not (not setnu-mode)))
-    (inhibit-quit t))
-    (setq setnu-mode (or (and arg (> (prefix-numeric-value arg) 0))
-             (and (null arg) (null setnu-mode))))
-    (if (not (eq oldmode setnu-mode))
-    (if setnu-mode
-        (setnu-mode-on)
-      (setnu-mode-off)))))
-
-(defun turn-on-setnu-mode ()
-  "Turn on setnu-mode.
-Useful for adding to a major-mode hook variable.
-Example:
-    (add-hook 'text-mode-hook 'turn-on-setnu-mode)
-to automatically turn on line numbering when enterting text-mode."
-  (setnu-mode 1))
-
-;;; Internal functions
-
-;;; The program is written using XEmacs terminology,
-;;; e.g. extents, glyphs, etc.  Functions are defined to twist
-;;; the FSF Emacs overlay API into the XEmacs model.
-
-(defconst setnu-running-under-xemacs
-  (or (string-match "XEmacs" emacs-version)
-      (string-match "Lucid" emacs-version)))
-
-(if setnu-running-under-xemacs
-    (fset 'setnu-make-extent 'make-extent)
-  (fset 'setnu-make-extent 'make-overlay))
-
-(if setnu-running-under-xemacs
-    (fset 'setnu-delete-extent 'delete-extent)
-  (fset 'setnu-delete-extent 'delete-overlay))
-
-(if setnu-running-under-xemacs
-    (fset 'setnu-extent-property 'extent-property)
-  (fset 'setnu-extent-property 'overlay-get))
-
-(if setnu-running-under-xemacs
-    (fset 'setnu-set-extent-property 'set-extent-property)
-  (fset 'setnu-set-extent-property 'overlay-put))
-
-(if setnu-running-under-xemacs
-    (fset 'setnu-set-extent-endpoints 'set-extent-endpoints)
-  (fset 'setnu-set-extent-endpoints 'move-overlay))
-
-(if setnu-running-under-xemacs
-    (fset 'setnu-extent-end-position 'extent-end-position)
-  (fset 'setnu-extent-end-position 'overlay-end))
-
-(if setnu-running-under-xemacs
-    (fset 'setnu-extent-start-position 'extent-start-position)
-  (fset 'setnu-extent-start-position 'overlay-start))
-
-(if setnu-running-under-xemacs
-    (defun setnu-set-extent-begin-glyph (e g)
-      (set-extent-begin-glyph e g 'outside-margin))
-  (defun setnu-set-extent-begin-glyph (e g)
-    (overlay-put e setnu-begin-glyph-property g)))
-
-(fset 'setnu-make-glyph (if setnu-running-under-xemacs 'make-glyph 'identity))
-
-(cond ((and setnu-running-under-xemacs (fboundp 'set-glyph-face))
-       (fset 'setnu-set-glyph-face 'set-glyph-face))
-      (setnu-running-under-xemacs
-       (fset 'setnu-set-glyph-face 'ignore))
-      (t                ; FSF Emacs
-       (defun setnu-set-glyph-face (g face)
-     (put-text-property 0 (length g) 'face face g))))
-
-(defun setnu-mode-off ()
-  "Internal shutdown of setnu-mode.
-Deletes the extents associated with setnu-mode."
-  (if (and setnu-running-under-xemacs
-       (fboundp 'remove-specifier))
-      (remove-specifier left-margin-width (current-buffer)))
-  (if setnu-start-extent
-      (let (e ee)
-    (setq e setnu-start-extent)
-    (while e
-      (setq ee e)
-      (setq e (setnu-extent-property e 'setnu-next-extent))
-      (setnu-delete-extent ee))
-    (setq setnu-start-extent nil))))
-
-(defun setnu-mode-on ()
-  "Internal startup of setnu-mode.
-Sets up the extents associated with setnu-mode."
-  (if (and setnu-running-under-xemacs
-       (fboundp 'set-specifier))
-      (set-specifier left-margin-width 6 (current-buffer)))
-  (let ((done nil)
-    (curr-e nil)
-    (n 1)
-    (match-data (match-data))
-    e start numstr)
-    (unwind-protect
-    (save-excursion
-      (save-restriction
-        (widen)
-        (goto-char (point-min))
-        (setq start (point))
-        (while (not done)
-          (setq done (null (search-forward "\n" nil 0)))
-          (setq e (setnu-make-setnu-extent start (point)))
-          (if (null setnu-start-extent)
-          (setq setnu-start-extent e
-            curr-e e)
-        (setnu-set-extent-property curr-e 'setnu-next-extent e)
-        (setnu-set-extent-property e 'setnu-prev-extent curr-e)
-        (setq curr-e e))
-          (setq numstr (format setnu-line-number-format n))
-          (setnu-set-extent-property e 'line-number numstr)
-          (setnu-set-extent-begin-glyph e (setnu-number-glyph numstr))
-          (setq n (1+ n)
-            start (point)))))
-      (store-match-data match-data))))
-
-(defun setnu-before-change-function (start end)
-  "Before change function for setnu-mode.
-Notices when a delete is about to delete some lines and adjusts
-the line number extents accordingly."
-  (if (or (not setnu-mode) (= start end))
-      () ;; not in setnu-mode or this is an insertion
-    (let ((inhibit-quit t)
-      (start-e nil)
-      (match-data (match-data))
-      end-e saved-next e ee)
-      (unwind-protect
-      (save-excursion
-        (save-restriction
-          (widen)
-          (goto-char start)
-          (if (search-forward "\n" end t)
-          (progn
-            (setq start-e (setnu-extent-at-create start nil)
-              saved-next (setnu-extent-property
-                      start-e
-                      'setnu-next-extent))
-            (setq end-e (setnu-extent-at-create end nil))
-            (setnu-set-extent-endpoints
-             start-e
-             (setnu-extent-start-position start-e)
-             (setnu-extent-end-position end-e))
-            (setnu-set-extent-property
-             start-e 'setnu-next-extent
-             (setnu-extent-property end-e 'setnu-next-extent))))
-          (if start-e
-          (progn
-            (setq e (setnu-extent-property start-e 'setnu-next-extent)
-              ee saved-next)
-            (while (and e (setnu-extent-property e 'setnu-next-extent))
-              (setq e (setnu-extent-property e 'setnu-next-extent)
-                ee (setnu-extent-property ee 'setnu-next-extent)))
-            (while (and e (not (eq ee start-e)))
-              (setnu-set-extent-begin-glyph
-               e (setnu-extent-property ee setnu-begin-glyph-property))
-              (setnu-set-extent-property
-               e 'line-number (setnu-extent-property ee 'line-number))
-              (setq e (setnu-extent-property e 'setnu-prev-extent)
-                ee (setnu-extent-property ee 'setnu-prev-extent)))
-            (setq end-e (setnu-extent-property start-e
-                               'setnu-next-extent))
-            (and end-e
-             (setnu-set-extent-property end-e
-                            'setnu-prev-extent
-                            start-e))
-            (setq e saved-next)
-            (while (not (eq e end-e))
-              (setq ee e
-                e (setnu-extent-property e 'setnu-next-extent))
-              (setnu-delete-extent ee))))))
-    (store-match-data match-data)))))
-
-(defun setnu-after-change-function (start end length)
-  "After change function for setnu-mode.
-Notices when an insert has added some lines and adjusts
-the line number extents accordingly."
-  (if (or (not setnu-mode) (= start end))
-      () ; not in setnu-mode or this is a deletion
-    (let ((inhibit-quit t)
-      (ee nil)
-      (match-data (match-data))
-      (new-lines 0)
-      start-e e saved-end saved-next n numstr)
-      (unwind-protect
-      (save-excursion
-        (save-restriction
-          (widen)
-          (setq start-e (setnu-extent-at-create start nil))
-          (if (< (setnu-extent-end-position start-e) (point))
-          ;; bogus!  insertion didn't put the text into
-          ;; the extent because,
-          ;; a. the extent was zero length or
-          ;; b. this is FSF Emacs which means chars
-          ;;    inserted at the end position of an extent
-          ;;    are not inserted into the extent.
-          (setnu-set-extent-endpoints
-           start-e
-           (setnu-extent-start-position start-e)
-           end))
-          (setq saved-next (setnu-extent-property start-e
-                              'setnu-next-extent)
-            saved-end (setnu-extent-end-position start-e)
-            e start-e)
-          (goto-char start)
-          (while (search-forward "\n" end 0)
-        (setnu-set-extent-endpoints e
-                        (setnu-extent-start-position e)
-                        (point))
-        (setq ee (setnu-make-setnu-extent (point) (point)))
-        (setnu-set-extent-property e 'setnu-next-extent ee)
-        (setnu-set-extent-property ee 'setnu-prev-extent e)
-        (setq e ee new-lines (1+ new-lines)))
-          (if ee
-          (progn
-            (setnu-set-extent-endpoints
-             e (setnu-extent-start-position e) saved-end)
-            (setnu-set-extent-property e 'setnu-next-extent saved-next)
-            (and saved-next
-             (setnu-set-extent-property
-              saved-next 'setnu-prev-extent e))
-            (setq e (setnu-extent-property start-e 'setnu-next-extent)
-              ee saved-next)
-            (while ee
-              (setnu-set-extent-begin-glyph
-               e (setnu-extent-property ee setnu-begin-glyph-property))
-              (setnu-set-extent-property
-               e 'line-number (setnu-extent-property ee 'line-number))
-              (setq e (setnu-extent-property e 'setnu-next-extent)
-                ee (setnu-extent-property ee 'setnu-next-extent)))
-            (setq n (1+ (string-to-int
-                 (setnu-extent-property
-                  (setnu-extent-property e 'setnu-prev-extent)
-                  'line-number))))
-            (while e
-              (setq numstr (format setnu-line-number-format n))
-              (setnu-set-extent-property e 'line-number numstr)
-              (setnu-set-extent-begin-glyph
-               e (setnu-number-glyph numstr))
-              (setq e (setnu-extent-property e 'setnu-next-extent)
-                n (1+ n)))))))
-    (store-match-data match-data)))))
-
-(defun setnu-number-glyph (number-string)
-  (let ((sym (intern number-string setnu-glyph-obarray)))
-    (if (boundp sym)
-    (symbol-value sym)
-      (let ((g (setnu-make-glyph number-string)))
-    (set sym g)
-    (setnu-set-glyph-face g setnu-line-number-face)
-    g ))))
-
-(defun setnu-make-setnu-extent (beg end)
-  "Create an extent and set some properties that all setnu extents have."
-  (let ((e (setnu-make-extent beg end)))
-    (setnu-set-extent-property e 'setnu t)
-;;    (setnu-set-extent-property e 'begin-glyph-layout 'outside-margin)
-    (setnu-set-extent-property e 'detachable nil)
-    (setnu-set-extent-property e 'evaporate nil)
-    e ))
-
-(cond ((fboundp 'overlays-in) ;; expect to see this in 19.30
-       (defun setnu-extent-at (pos buf)
-     "Finds the setnu extent at the position POS in the buffer BUF."
-     (catch 'done
-       (save-excursion
-         (and buf (set-buffer buf))
-         (let ((o-list (overlays-in pos (1+ pos))))
-           (while o-list
-         (if (overlay-get (car o-list) 'setnu)
-             (throw 'done (car o-list)))
-         (setq o-list (cdr o-list)))
-           nil )))))
-      ((fboundp 'overlays-at)
-       (defun setnu-extent-at (pos buf)
-     "Finds the setnu extent at the position POS in the buffer BUF."
-     (catch 'done
-       (save-excursion
-         (and buf (set-buffer buf))
-         (let ((o-list (overlays-at pos)) o-lists)
-           ;; search what overlays-at returns first.  for all
-           ;; but zero length extents this will return the
-           ;; extent we want.
-           (while o-list
-         (if (overlay-get (car o-list) 'setnu)
-             (throw 'done (car o-list)))
-         (setq o-list (cdr o-list)))
-           ;; No luck.  Search the lists returned by
-           ;; overlay-lists.  Use overlays-recenter so we only
-           ;; have to search the `before' lobe of the return
-           ;; value.
-           (overlay-recenter (1- pos))
-           (setq o-lists (overlay-lists))
-           (setq o-list (cdr o-lists))
-           (while o-list
-         (if (and (overlay-get (car o-list) 'setnu)
-              (or (and (= pos (overlay-start (car o-list)))
-                   (= pos (overlay-end (car o-list))))
-                  (and (>= pos (overlay-start (car o-list)))
-                   (< pos (overlay-end (car o-list))))))
-             (throw 'done (car o-list)))
-         (setq o-list (cdr o-list)))
-           nil )))))
-       ((fboundp 'map-extents)
-    (defun setnu-extent-at (pos buf)
-      "Finds the setnu extent at the position POS in the buffer BUF."
-      (map-extents (function (lambda (e maparg)
-                   (if (setnu-extent-property e 'setnu)
-                       e
-                     nil)))
-               buf pos pos)))
-       (t (error "can't find overlays-in, overlays-at, or map-extents!")))
-
-(defun setnu-extent-at-create (pos buf)
-  "Like `setnu-extent-at' except if an extent isn't found, then
-it is created based on where the extent failed to be found."
-  (let ((e (setnu-extent-at pos buf)) ee beg numstr)
-    (if e
-    e
-      ;; no extent found so one must be created.
-      (save-excursion
-    (goto-char pos)
-    (beginning-of-line)
-    (setq e (setnu-extent-at (point) buf))
-    (cond (e
-           ;; found one.  extend it to cover this whole line.
-           ;; this takes care of zero length extents that
-           ;; might exist at bob or eob that can't be
-           ;; inserted into.
-           (setq beg (point))
-           (forward-line 1)
-           (setnu-set-extent-endpoints e beg (point))
-           e )
-          ((bobp)
-           ;; we are at bob and there's no extent.
-           ;;
-           ;; this is because the extent that was there got
-           ;; detached because all the text in the buffer was
-           ;; deleted.  so we create a new extent and make it
-           ;; contain the whole buffer, since there can be no
-           ;; other attached extents.
-           (setq e (setnu-make-setnu-extent (point-min) (point-max))
-             numstr (format setnu-line-number-format 1))
-           (setnu-set-extent-property e 'line-number numstr)
-           (setnu-set-extent-begin-glyph e (setnu-number-glyph numstr))
-           (setq setnu-start-extent e)
-           e )
-          (t
-           ;; we must be at eob and there's no extent.
-           ;;
-           ;; this is because the extent that was there
-           ;; shrank to zero length and was detached.  create
-           ;; a new extent that contains all text from point
-           ;; to pos.
-           (setq e (setnu-make-setnu-extent (point) pos))
-           (setq ee (setnu-extent-at (1- (point)) buf))
-           (setnu-set-extent-property e 'setnu-prev-extent ee)
-           (setnu-set-extent-property ee 'setnu-next-extent e)
-           (setq numstr
-             (format setnu-line-number-format
-                 (1+ (string-to-int
-                  (setnu-extent-property ee 'line-number)))))
-           (setnu-set-extent-property e 'line-number numstr)
-           (setnu-set-extent-begin-glyph e (setnu-number-glyph numstr))
-           e ))))))
-
-(add-hook 'before-change-functions 'setnu-before-change-function)
-(add-hook 'after-change-functions 'setnu-after-change-function)