unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* `goto-char' in callback to `url-retrieve'
@ 2012-02-29 12:55 Deniz Dogan
  2012-02-29 18:16 ` Johan Bockgård
  2012-03-01 10:27 ` Lynbech Christian
  0 siblings, 2 replies; 3+ messages in thread
From: Deniz Dogan @ 2012-02-29 12:55 UTC (permalink / raw)
  To: emacs-devel

I'm using the following code to play around with `url-retrieve':

(defun rss-get-feed-callback (status url)
   (switch-to-buffer (current-buffer))
   (goto-char 0))

(defun rss-get-feed (url)
   (url-retrieve url 'rss-get-feed-callback (list url) t t))

(defun rss-test ()
   (interactive)
   (rss-get-feed "http://blogg.aftonbladet.se/feeds/entries/bankoniva/rss"))

When I hit M-x rss-test RET, I expect point to be at the first character 
of the result buffer, but it is nevertheless at the end.

Is this a bug?  I'm using: GNU Emacs 24.0.93.1 (i386-mingw-nt6.1.7601) 
of 2012-02-16 on MARVIN

Cheers,
Deniz



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

* Re: `goto-char' in callback to `url-retrieve'
  2012-02-29 12:55 `goto-char' in callback to `url-retrieve' Deniz Dogan
@ 2012-02-29 18:16 ` Johan Bockgård
  2012-03-01 10:27 ` Lynbech Christian
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Bockgård @ 2012-02-29 18:16 UTC (permalink / raw)
  To: emacs-devel

Deniz Dogan <deniz@dogan.se> writes:

> When I hit M-x rss-test RET, I expect point to be at the first
> character of the result buffer, but it is nevertheless at the end.

The callback is called inside `save-excursion'.



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

* Re: `goto-char' in callback to `url-retrieve'
  2012-02-29 12:55 `goto-char' in callback to `url-retrieve' Deniz Dogan
  2012-02-29 18:16 ` Johan Bockgård
@ 2012-03-01 10:27 ` Lynbech Christian
  1 sibling, 0 replies; 3+ messages in thread
From: Lynbech Christian @ 2012-03-01 10:27 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: emacs-devel@gnu.org

Even if not truly relevant here (due to the save-excursion mentioned in
the followup), you may want to consider using

        (goto-char (point-min))

as a better idiom than 

        (goto-char 0)

since the former will also correctly handle narrowed buffers.


------------------------+-----------------------------------------------------
Christian Lynbech       | christian #\@ defun #\. dk
------------------------+-----------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)





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

end of thread, other threads:[~2012-03-01 10:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-29 12:55 `goto-char' in callback to `url-retrieve' Deniz Dogan
2012-02-29 18:16 ` Johan Bockgård
2012-03-01 10:27 ` Lynbech Christian

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