Discussion:
is there any hook like switch-buffer-hook or change-buffer-hook?
Vektor
2004-08-27 00:48:55 UTC
Permalink
i want to do something when i switch among buffers, but i don't find
variable like switch-buffer-hook or change-buffer-hook.

or there is another way to do such a thing?

thanks in advance.
--
Remove all XYZ from my email to get the real one.
Joakim Hove
2004-08-27 06:29:56 UTC
Permalink
Post by Vektor
i want to do something when i switch among buffers, but i don't find
variable like switch-buffer-hook or change-buffer-hook.
I dont know for sure, but a quick check of: M-x apropos 'buffer.*hook'
revealed nothing.
Post by Vektor
or there is another way to do such a thing?
Maybe you could try to advise the set-buffer or switch-to-buffer
functions. See the section "Advising Functions" in the Elisp (info)
manual.


HTH - Joakim
--
Joakim Hove
hove AT ift uib no
+47 (55 5)8 27 90
http://www.ift.uib.no/~hove/
Vektor
2004-08-28 05:41:57 UTC
Permalink
I have consult the elisp info and find this IS exactly what I need now.
Thank you again for the useful information.
Post by Joakim Hove
Maybe you could try to advise the set-buffer or switch-to-buffer
functions. See the section "Advising Functions" in the Elisp (info)
manual.
--
Remove all XYZ from my email to get the real one.
Sandip Chitale
2004-08-27 07:23:08 UTC
Permalink
List of hook variables:

How did I get these?
C-h v TAB gives me list of all variables. Then I filtered words with word 'hook' in them.
See if you find one you need.

after-init-hook
after-revert-hook
after-save-hook
after-setting-font-hook
align-load-hook
apropos-mode-hook
auto-image-file-mode-hook
auto-save-hook
before-init-hook
before-make-frame-hook
before-revert-hook
browse-url-of-file-hook
bytecomp-load-hook
c++-mode-hook
c-initialization-hook
c-mode-common-hook
c-mode-hook
c-prepare-bug-report-hooks
c-special-indent-hook
calendar-load-hook
calendar-move-hook
change-major-mode-hook
clone-buffer-hook
color-theme-mode-hook
comint-exec-hook
comint-mode-hook
command-hook-internal
compilation-mode-hook
completion-setup-hook
custom-define-hook
custom-mode-hook
cvs-dired-use-hook
desktop-delay-hook
desktop-save-hook
diary-display-hook
diary-hook
dired-after-readin-hook
dired-before-readin-hook
dired-load-hook
dired-mode-hook
disabled-command-hook
dtd-mode-hooks
ecb-activate-before-layout-draw-hook
ecb-activate-before-new-frame-created-hook
ecb-activate-hook
ecb-deactivate-hook
ecb-post-command-hooks
ecb-unhighlight-hook-called
echo-area-clear-hook
edebug-setup-hook
ediff-after-session-group-setup-hook
ediff-after-setup-control-frame-hook
ediff-after-setup-windows-hook
ediff-before-session-group-setup-hooks
ediff-before-setup-control-frame-hook
ediff-before-setup-hook
ediff-before-setup-windows-hook
ediff-cleanup-hook
ediff-display-help-hook
ediff-keymap-setup-hook
ediff-load-hook
ediff-meta-buffer-keymap-setup-hook
ediff-mode-hook
ediff-prepare-buffer-hook
ediff-quit-hook
ediff-quit-merge-hook
ediff-quit-session-group-hook
ediff-registry-setup-hook
ediff-select-hook
ediff-show-registry-hook
ediff-show-session-group-hook
ediff-startup-hook
ediff-suspend-hook
ediff-unselect-hook
eieio-hook
electric-help-mode-hook
emacs-lisp-mode-hook
emacs-startup-hook
exit-language-environment-hook
find-file-hooks
find-file-not-found-hooks
find-tag-hook
first-change-hook
font-lock-mode-hook
global-font-lock-mode-hook
hack-local-variables-hook
help-mode-hook
hs-hide-hook
idl-mode-hook
imenu-after-jump-hook
inferior-lisp-mode-hook
inhibit-modification-hooks
inhibit-point-motion-hooks
initial-calendar-window-hook
input-method-activate-hook
input-method-after-insert-chunk-hook
input-method-inactivate-hook
isearch-mode-end-hook
isearch-mode-hook
java-mode-hook
jde-bug-minor-mode-hook
jde-compile-finish-hook
jde-db-mode-hook
jde-dbs-debugger-hook
jde-entering-java-buffer-hook
jde-mode-hook
jde-package-load-hook
jde-project-hooks
jde-run-mode-hook
kill-buffer-hook
kill-emacs-hook
lisp-interaction-mode-hook
lisp-mode-hook
list-diary-entries-hook
local-write-file-hooks
log-view-mode-hook
makefile-mode-hook
mark-diary-entries-hook
menu-bar-update-hook
minibuffer-exit-hook
minibuffer-setup-hook
mouse-leave-buffer-hook
nongregorian-diary-listing-hook
nongregorian-diary-marking-hook
objc-mode-hook
outline-view-change-hook
pike-mode-hook
post-command-hook
post-command-idle-hook
pre-abbrev-expand-hook
pre-command-hook
print-diary-entries-hook
quail-activate-hook
quickurl-reread-hook-postfix
recentf-load-hook
recentf-mode-hook
rmail-delete-message-hook
rmail-get-new-mail-hook
rmail-mode-hook
rmail-quit-hook
rmail-show-message-hook
scheme-mode-hook
semantic-after-partial-cache-change-hook
semantic-after-toplevel-bovinate-hook
semantic-after-toplevel-cache-change-hook
semantic-auto-parse-mode-hook
semantic-before-toplevel-bovination-hook
semantic-before-toplevel-cache-flush-hook
semantic-change-hooks
semantic-clean-token-hooks
semantic-dirty-token-hooks
semantic-init-db-hooks
semantic-init-hooks
semantic-no-reparse-needed-change-hook
semantic-pre-clean-token-hooks
semantic-reparse-needed-change-hook
semantic-show-dirty-mode-hook
semantic-show-unmatched-syntax-mode-hook
semantic-summary-mode-hook
semantic-unmatched-syntax-hook
semanticdb-hooks
semanticdb-mode-hooks
semanticdb-save-database-hooks
semanticdb-semantic-init-hook-overload
senator-minor-mode-hook
session-after-load-save-file-hook
session-before-save-hook
set-language-environment-hook
show-paren-mode-hook
signal-hook-function
speedbar-before-delete-hook
speedbar-before-popup-hook
speedbar-load-hook
speedbar-mode-hook
speedbar-reconfigure-keymaps-hook
speedbar-scanner-reset-hook
speedbar-timer-hook
speedbar-vc-in-control-hook
speedbar-vc-path-enable-hook
speedbar-visiting-file-hook
speedbar-visiting-tag-hook
suspend-hook
suspend-resume-hook
swbuff-load-hook
temp-buffer-resize-mode-hook
temp-buffer-setup-hook
temp-buffer-show-hook
term-setup-hook
texinfo-mode-hook
text-mode-hook
today-invisible-calendar-hook
today-visible-calendar-hook
tool-bar-mode-hook
unify-8859-on-decoding-mode-hook
unify-8859-on-encoding-mode-hook
vc-before-checkin-hook
vc-checkin-hook
vc-checkout-hook
vc-log-after-operation-hook
vc-logentry-check-hook
vhdl-mode-hook
which-function-mode-hook
window-configuration-change-hook
window-setup-hook
write-contents-hooks
write-file-hooks
Post by Vektor
i want to do something when i switch among buffers, but i don't find
variable like switch-buffer-hook or change-buffer-hook.
or there is another way to do such a thing?
thanks in advance.
--
Remove all XYZ from my email to get the real one.
Eli Zaretskii
2004-08-27 10:04:47 UTC
Permalink
Date: Fri, 27 Aug 2004 00:23:08 -0700
How did I get these?
C-h v TAB gives me list of all variables. Then I filtered words with word 'hook' in them.
What's wrong with "M-x apropos-variable RET"?
Sandip Chitale
2004-08-27 20:49:10 UTC
Permalink
Post by Eli Zaretskii
Date: Fri, 27 Aug 2004 00:23:08 -0700
How did I get these?
C-h v TAB gives me list of all variables. Then I filtered words with
word 'hook' in them.
Post by Eli Zaretskii
What's wrong with "M-x apropos-variable RET"?
Nothing. I simply did not know about it. Thanks for the info.
bojohan+ (Johan Bockgård)
2004-08-27 12:51:39 UTC
Permalink
Post by Vektor
i want to do something when i switch among buffers, but i don't find
variable like switch-buffer-hook or change-buffer-hook.
http://groups.google.com/groups?selm=***@mole.gnu.ai.mit.edu
Stefan Monnier
2004-08-27 16:18:00 UTC
Permalink
Post by Vektor
i want to do something when i switch among buffers, but i don't find
variable like switch-buffer-hook or change-buffer-hook.
I suspect that you don't really understand what is "a buffer
switch" seen from elisp's point of view (i.e. that you have your own idea
of what is a "buffer switch" but that Emacs would have to read your mind
in order to know when those things happen and when they don't).

So could you explain exactly what you want to do?


Stefan
Loading...