unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* go from *Process List* to each process's buffer easy
@ 2003-10-18  6:03 Dan Jacobson
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Jacobson @ 2003-10-18  6:03 UTC (permalink / raw)


Hitting RET on a line in the *Process List* buffer should take one to
that process's buffer, if any.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: go from *Process List* to each process's buffer easy
       [not found] <mailman.1958.1066516144.21628.bug-gnu-emacs@gnu.org>
@ 2003-10-21  0:06 ` Kevin Rodgers
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2003-10-21  0:06 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 726 bytes --]

Dan Jacobson wrote:

> Hitting RET on a line in the *Process List* buffer should take one to
> that process's buffer, if any.

One way you could do that would be to temporarily bind temp-buffer-show-hook

in list-processes.  I don't know to do that in C, though, so I experimented
by advising it (which works if you call it via `M-x list-processes').  The
new hook function has to parse the *Process List* buffer, which is kind of
nasty because the Proc and Buffer columns can be arbitrary strings (including
spaces) and may be shifted to the right.  (The *Completions* buffer used to
have the same problem, but now you can use the mouse-face property to find
the individual items.)  Anyway, here's a hack to get you started:

[-- Attachment #2: list-processes-make-xrefs.el --]
[-- Type: text/plain, Size: 1408 bytes --]

(defadvice list-processes (around make-xrefs activate)
  "Add hyperlinks to select each process buffer."
  (let ((temp-buffer-show-hook 'list-processes-make-xrefs))
    ad-do-it))

(defun list-processes-make-xrefs (&optional buffer)
  "Add bindings to select each process buffer via `local-keymap' overlay properties."
  (save-excursion
    (set-buffer (or buffer (current-buffer)))
    (goto-char (point-min))
    ;; See src/process.c:list_processes_1():
    (or (re-search-forward "^-+  +-+  +-+  +-+  +-+$" nil t)
	(error "*Process List* header not found"))
    (forward-line 1)
    (let* ((proc-regexp "\\([a-zA-Z0-9---]+\\)")
           (status-regexp
            "\\(run\\|stop\\|exit\\|signal\\|open\\|closed\\|nil\\)")
           (buffer-regexp "\\([a-zA-Z0-9---<>*()]+ ?[a-zA-Z0-9---<>*()]+\\)")
           (proc-status-buffer-regexp
            (format "\\=%s  +%s  +%s  +"
                    proc-regexp status-regexp buffer-regexp))
           (help-echo
            (substitute-command-keys
             "\\<help-mode-map>\\[help-follow-mouse]: Select this buffer"))
           process-buffer)
      (while (re-search-forward proc-status-buffer-regexp nil t)
        (setq process-buffer (get-buffer (match-string 3)))
        (if process-buffer              ; not "(none)" or "(Killed)"
            (help-xref-button 3 'switch-to-buffer process-buffer help-echo))
        (forward-line 1)))))

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-10-21  0:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1958.1066516144.21628.bug-gnu-emacs@gnu.org>
2003-10-21  0:06 ` go from *Process List* to each process's buffer easy Kevin Rodgers
2003-10-18  6:03 Dan Jacobson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).