unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: go from *Process List* to each process's buffer easy
Date: Mon, 20 Oct 2003 18:06:19 -0600	[thread overview]
Message-ID: <3F94787B.9030005@yahoo.com> (raw)
In-Reply-To: mailman.1958.1066516144.21628.bug-gnu-emacs@gnu.org

[-- 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

       reply	other threads:[~2003-10-21  0:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1958.1066516144.21628.bug-gnu-emacs@gnu.org>
2003-10-21  0:06 ` Kevin Rodgers [this message]
2003-10-18  6:03 go from *Process List* to each process's buffer easy Dan Jacobson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F94787B.9030005@yahoo.com \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).