[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Adding a hook to list-processes
From: |
Bob Rogers |
Subject: |
Adding a hook to list-processes |
Date: |
Sat, 27 Nov 2010 13:52:45 -0500 |
I tried to do this using the patch below; it compiles without
warning, but seems to have no effect. Evaluating the following code in
src/emacs:
(defun rgr-list-processes-hook ()
(message "In buffer %S" (current-buffer)))
(add-hook 'after-list-processes-hook 'rgr-list-processes-hook)
and then "M-x list-processes RET" does not produce the expected message.
I cargo-culted this based on Qmouse_leave_buffer_hook; what did I do
wrong? TIA,
-- Bob Rogers
http://www.rgrjr.com/
P.S. FWIW, I'm trying to turn the buffer names into buttons. Given my
C skills, using a hook seemed like a safer bet.
------------------------------------------------------------------------
diff --git a/src/process.c b/src/process.c
index f8ca095..e95d465 100644
--- a/src/process.c
+++ b/src/process.c
@@ -113,6 +113,7 @@ along with GNU Emacs. If not, see
<http://www.gnu.org/licenses/>. */
#include "nsterm.h"
#endif
+Lisp_Object Vafter_list_processes_hook, Qafter_list_processes_hook;
Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid;
Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime;
Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs;
@@ -1493,6 +1494,11 @@ list_processes_1 (Lisp_Object query_only)
status_notify (NULL);
redisplay_preserve_echo_area (13);
}
+
+ /* Give other code a chance to tweak the buffer. */
+ if (!NILP (Vafter_list_processes_hook))
+ call1 (Vrun_hooks, Qafter_list_processes_hook);
+
return Qnil;
}
@@ -7736,6 +7742,13 @@ The variable takes effect when `start-process' is
called. */);
#endif /* subprocesses */
+ Qafter_list_processes_hook = intern_c_string ("mouse-leave-buffer-hook");
+ staticpro (&Qafter_list_processes_hook);
+
+ DEFVAR_LISP ("after-list-processes-hook", &Vafter_list_processes_hook,
+ doc: /* Hook run after list-processes. */);
+ Vafter_list_processes_hook = Qnil;
+
defsubr (&Sget_buffer_process);
defsubr (&Sprocess_inherit_coding_system_flag);
defsubr (&Slist_system_processes);
- Adding a hook to list-processes,
Bob Rogers <=