From: Nick Roberts <nickrob@snap.net.nz>
Subject: Re: [PATCH] find-file-noselect-1
Date: Fri, 11 Feb 2005 16:03:46 +1300 [thread overview]
Message-ID: <16908.8338.858602.199031@farnswood.snap.net.nz> (raw)
In-Reply-To: <16908.7466.270296.502380@farnswood.snap.net.nz>
> Where could I add such a hook, so that it would always be included?
Answering my own question: it can be added in gdb-ui.el. The following patch
is only for gdb-ui.el, but it adds a function to find-file-hook. I guess it
could still break find-file, if its not right.
Is it OK to install this?
Nick
*** /home/nick/emacs/lisp/progmodes/gdb-ui.el.~1.47.~ 2005-02-10 08:22:54.000000000 +1300
--- /home/nick/emacs/lisp/progmodes/gdb-ui.el 2005-02-11 15:53:01.000000000 +1300
***************
*** 2085,2090 ****
--- 2085,2113 ----
(goto-line (string-to-number line))
(gdb-put-breakpoint-icon (eq flag ?y) bptno))))
+ (add-hook 'find-file-hook 'gdb-find-file-hook)
+
+ (defun gdb-find-file-hook ()
+ (if (and (boundp 'gud-comint-buffer)
+ (buffer-name gud-comint-buffer)
+ (with-current-buffer gud-comint-buffer
+ (eq gud-minor-mode 'gdba)))
+ (progn
+ (gdb-enqueue-input
+ (list (concat "list " (file-name-nondirectory buffer-file-name)
+ ":1\n")
+ `(lambda () (gdb-set-gud-minor-mode ,buffer-file-name)))))))
+
+ (defun gdb-set-gud-minor-mode (file)
+ "Set gud-minor-mode from find-file if appropriate."
+ (goto-char (point-min))
+ (unless (search-forward "No source file named " nil t)
+ (with-current-buffer
+ (find-file-noselect file)
+ (save-current-buffer
+ (set (make-local-variable 'gud-minor-mode) 'gdba)
+ (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)))))
+
;;from put-image
(defun gdb-put-string (putstring pos &optional dprop)
"Put string PUTSTRING in front of POS in the current buffer.
next prev parent reply other threads:[~2005-02-11 3:03 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-10 20:36 [PATCH] find-file-noselect-1 Nick Roberts
2005-02-11 0:19 ` Miles Bader
2005-02-11 2:49 ` Nick Roberts
2005-02-11 3:03 ` Nick Roberts [this message]
2005-02-12 8:38 ` Richard Stallman
2005-02-12 10:30 ` Nick Roberts
2005-02-12 16:50 ` Stefan Monnier
2005-02-13 5:31 ` Nick Roberts
2005-02-13 16:14 ` Stefan Monnier
2005-02-13 12:38 ` Richard Stallman
2005-02-13 20:49 ` Nick Roberts
2005-02-15 6:15 ` Richard Stallman
2005-02-11 3:16 ` Stefan Monnier
2005-02-11 3:19 ` Stefan Monnier
2005-02-11 8:08 ` Nick Roberts
2005-02-11 8:51 ` Kim F. Storm
2005-02-11 9:53 ` Nick Roberts
2005-02-11 10:30 ` Kim F. Storm
2005-02-11 10:05 ` Miles Bader
2005-02-11 10:29 ` Kim F. Storm
2005-02-11 10:44 ` Nick Roberts
2005-02-11 13:05 ` Kim F. Storm
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16908.8338.858602.199031@farnswood.snap.net.nz \
--to=nickrob@snap.net.nz \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.