1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00

find-file-hooks -> find-file-hook.

This commit is contained in:
Stefan Monnier 2005-03-24 22:17:43 +00:00
parent 781da985a7
commit ffc30f4fa1
5 changed files with 47 additions and 46 deletions

View File

@ -1,7 +1,7 @@
;;; vi.el --- major mode for emulating "vi" editor under GNU Emacs
; This file is in the public domain because the authors distributed it
; without a copyright notice before the US signed the Bern Convention.
;; This file is in the public domain because the authors distributed it
;; without a copyright notice before the US signed the Bern Convention.
;; This file is part of GNU Emacs.
@ -11,32 +11,32 @@
;;; Commentary:
; Originally written by : seismo!wucs!nz@rsch.wisc.edu (Neal Ziring)
; Extensively redesigned and rewritten by wu@crys.wisc.edu (Felix S.T. Wu)
; Last revision: 01/07/87 Wed (for GNU Emacs 18.33)
;; Originally written by : seismo!wucs!nz@rsch.wisc.edu (Neal Ziring)
;; Extensively redesigned and rewritten by wu@crys.wisc.edu (Felix S.T. Wu)
;; Last revision: 01/07/87 Wed (for GNU Emacs 18.33)
;; INSTALLATION PROCEDURE:
;; 1) Add a global key binding for command "vi-mode" (I use ESC ESC instead of
;; the single ESC used in real "vi", so I can access other ESC prefixed emacs
;; commands while I'm in "vi"), say, by putting the following line in your
;; ".emacs" file:
;; (define-key global-map "\e\e" 'vi-mode) ;quick switch into vi-mode
;; 2) If you wish you can define "find-file-hook" to enter "vi" automatically
;; after a file is loaded into the buffer. For example, I defined it as:
;; (setq find-file-hook (list
;; (function (lambda ()
;; (if (not (or (eq major-mode 'Info-mode)
;; (eq major-mode 'vi-mode)))
;; (vi-mode))))))
;; 3) In your .emacs file you can define the command "vi-mode" to be "autoload"
;; or you can execute the "load" command to load "vi" directly.
;; 4) Read the comments for command "vi-mode" before you start using it.
;; COULD DO
;; 1). A general 'define-operator' function to replace current hack
;; 2). In operator handling, should allow other point moving Emacs commands
;; (such as ESC <, ESC >) to be used as arguments.
; INSTALLATION PROCEDURE:
; 1) Add a global key binding for command "vi-mode" (I use ESC ESC instead of
; the single ESC used in real "vi", so I can access other ESC prefixed emacs
; commands while I'm in "vi"), say, by putting the following line in your
; ".emacs" file:
; (define-key global-map "\e\e" 'vi-mode) ;quick switch into vi-mode
; 2) If you wish you can define "find-file-hooks" to enter "vi" automatically
; after a file is loaded into the buffer. For example, I defined it as:
; (setq find-file-hooks (list
; (function (lambda ()
; (if (not (or (eq major-mode 'Info-mode)
; (eq major-mode 'vi-mode)))
; (vi-mode))))))
; 3) In your .emacs file you can define the command "vi-mode" to be "autoload"
; or you can execute the "load" command to load "vi" directly.
; 4) Read the comments for command "vi-mode" before you start using it.
;
; COULD DO
; 1). A general 'define-operator' function to replace current hack
; 2). In operator handling, should allow other point moving Emacs commands
; (such as ESC <, ESC >) to be used as arguments.
;
;;; Code:
(defvar vi-mode-old-major-mode)
@ -1487,5 +1487,5 @@ With ARG, inserts that many newlines."
(provide 'vi)
;;; arch-tag: ac9bdac3-8acb-4ddd-bdae-c6dd873153b3
;; arch-tag: ac9bdac3-8acb-4ddd-bdae-c6dd873153b3
;;; vi.el ends here

View File

@ -1,6 +1,7 @@
;;; follow.el --- synchronize windows showing the same buffer
;; Copyright (C) 1995, 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1999, 2001, 2005
;; Free Software Foundation, Inc.
;; Author: Anders Lindgren <andersl@andersl.com>
;; Maintainer: Anders Lindgren <andersl@andersl.com>
@ -708,7 +709,7 @@ Keys specific to Follow mode:
;; This will start follow-mode whenever a new file is loaded, if
;; the variable `follow-auto' is non-nil.
(add-hook 'find-file-hooks 'follow-find-file-hook t)
(add-hook 'find-file-hook 'follow-find-file-hook t)
(defun follow-find-file-hook ()
"Find-file hook for Follow Mode. See the variable `follow-auto'."
@ -2347,5 +2348,5 @@ This prevents `mouse-drag-region' from messing things up."
;; | save it". -- Douglas Adams, "Last Chance to See" |
;; \------------------------------------------------------------------------/
;;; arch-tag: 7b16bb1a-808c-4991-a8cc-66d3822936d0
;; arch-tag: 7b16bb1a-808c-4991-a8cc-66d3822936d0
;;; follow.el ends here

View File

@ -401,7 +401,7 @@ INI file. This hook is NOT installed by default."
(ini-generic-mode)))))
(and generic-use-find-file-hook
(add-hook 'find-file-hooks 'generic-mode-find-file-hook))
(add-hook 'find-file-hook 'generic-mode-find-file-hook))
;;;###autoload
(defun generic-make-keywords-list (keywords-list face &optional prefix suffix)

View File

@ -1,6 +1,6 @@
;;; hi-lock.el --- minor mode for interactive automatic highlighting
;; Copyright (C) 2000, 2001 Free Software Foundation, Inc.
;; Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
;; Author: David M. Koppelman, koppel@ee.lsu.edu
;; Keywords: faces, minor-mode, matching, display
@ -292,7 +292,7 @@ is found. A mode is excluded if it's in the list `hi-lock-exclude-modes'."
(> (prefix-numeric-value arg) 0)))
;; Turned on.
(when (and (not hi-lock-mode-prev) hi-lock-mode)
(add-hook 'find-file-hooks 'hi-lock-find-file-hook)
(add-hook 'find-file-hook 'hi-lock-find-file-hook)
(add-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook)
(when (eq nil font-lock-defaults)
(setq font-lock-defaults '(nil)))
@ -313,7 +313,7 @@ is found. A mode is excluded if it's in the list `hi-lock-exclude-modes'."
hi-lock-file-patterns nil)
(when font-lock-mode (hi-lock-refontify)))))
(define-key-after menu-bar-edit-menu [hi-lock] nil)
(remove-hook 'find-file-hooks 'hi-lock-find-file-hook)
(remove-hook 'find-file-hook 'hi-lock-find-file-hook)
(remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook))))
@ -568,5 +568,5 @@ Optional argument END is maximum excursion."
(provide 'hi-lock)
;;; arch-tag: d2e8fd07-4cc9-4c6f-a200-1e729bc54066
;; arch-tag: d2e8fd07-4cc9-4c6f-a200-1e729bc54066
;;; hi-lock.el ends here

View File

@ -993,12 +993,12 @@ changes are made, so \\[highlight-changes-next-change] and
;; Global Highlight Changes mode is modeled after Global Font-lock mode.
;; Three hooks are used to gain control. When Global Changes Mode is
;; enabled, `find-file-hooks' and `change-major-mode-hook' are set.
;; `find-file-hooks' is called when visiting a file, the new mode is
;; enabled, `find-file-hook' and `change-major-mode-hook' are set.
;; `find-file-hook' is called when visiting a file, the new mode is
;; known at this time.
;; `change-major-mode-hook' is called when a buffer is changing mode.
;; This could be because of finding a file in which case
;; `find-file-hooks' has already been called and has done its work.
;; `find-file-hook' has already been called and has done its work.
;; However, it also catches the case where a new mode is being set by
;; the user. However, it is called from `kill-all-variables' and at
;; this time the mode is the old mode, which is not what we want.
@ -1080,18 +1080,18 @@ variable `highlight-changes-global-changes-existing-buffers' is non-nil).
(setq global-highlight-changes t)
(message "Turning ON Global Highlight Changes mode in %s state"
highlight-changes-global-initial-state)
(add-hook 'hilit-chg-major-mode-hook 'hilit-chg-major-mode-hook)
(add-hook 'find-file-hooks 'hilit-chg-check-global)
;; FIXME: Not sure what this was intended to do. --Stef
;; (add-hook 'hilit-chg-major-mode-hook 'hilit-chg-major-mode-hook)
(add-hook 'find-file-hook 'hilit-chg-check-global)
(if highlight-changes-global-changes-existing-buffers
(hilit-chg-update-all-buffers
highlight-changes-global-initial-state)))
(message "Turning OFF global Highlight Changes mode")
(remove-hook 'hilit-chg-major-mode-hook 'hilit-chg-major-mode-hook)
(remove-hook 'find-file-hooks 'hilit-chg-check-global)
(remove-hook 'post-command-hook
'hilit-chg-post-command-hook)
(remove-hook 'find-file-hooks 'hilit-chg-check-global)
;; FIXME: Not sure what this was intended to do. --Stef
;; (remove-hook 'hilit-chg-major-mode-hook 'hilit-chg-major-mode-hook)
(remove-hook 'post-command-hook 'hilit-chg-post-command-hook)
(remove-hook 'find-file-hook 'hilit-chg-check-global)
(if highlight-changes-global-changes-existing-buffers
(hilit-chg-update-all-buffers nil))))