unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Switch to buffer and line...
@ 2005-10-20 12:59 luca.spinacci
  0 siblings, 0 replies; 2+ messages in thread
From: luca.spinacci @ 2005-10-20 12:59 UTC (permalink / raw)




I have a buffer with number line and name of the new buffer to switch to:
pointing the
curson on the number line my function search backward for the name of the
buffer and
switch to that, but once it gets there the goto-line function doesn't take
me to the requested
line...


(defun retrieve-buffer-and-line-at-point()
  (interactive)
  ( save-excursion(if(number-at-point) ; check if the cursor is pointing a number of line
       (setq target (number-at-point)))
       (call-interactively 'switch-at-point) ; switch to buffer: it works correctly!
       (if(current-buffer)
       (goto-line target))))                             ; does nothing???

(defun switch-at-point()
  (interactive)
  (
   save-excursion(
     if(search-backward "in buffer: ")
     (
      save-excursion(end-of-line)
        (if(thing-at-point 'sexp)
            (switch-to-buffer(thing-at-point 'filename)))))))

Thanks in advance,
Luca.

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

* Re: Switch to buffer and line...
       [not found] <mailman.12004.1129813207.20277.help-gnu-emacs@gnu.org>
@ 2005-10-20 15:30 ` rgb
  0 siblings, 0 replies; 2+ messages in thread
From: rgb @ 2005-10-20 15:30 UTC (permalink / raw)


> (defun retrieve-buffer-and-line-at-point()
>   (interactive)
>   ( save-excursion(if(number-at-point) ; check if the cursor is pointing a number of line
>        (setq target (number-at-point)))
>        (call-interactively 'switch-at-point) ; switch to buffer: it works correctly!
>        (if(current-buffer)
>        (goto-line target))))                             ; does nothing???

Your goto-line is inside a save-excursion.
You ARE going there but then going back.

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

end of thread, other threads:[~2005-10-20 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.12004.1129813207.20277.help-gnu-emacs@gnu.org>
2005-10-20 15:30 ` Switch to buffer and line rgb
2005-10-20 12:59 luca.spinacci

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).