all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Repositioning point to buffer beginning
@ 2022-10-22  2:04 Heime via Users list for the GNU Emacs text editor
  2022-10-22  2:44 ` Emanuel Berg
  2022-10-22  6:50 ` Jean Louis
  0 siblings, 2 replies; 3+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2022-10-22  2:04 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

I am printing a list in a buffer, calling it many times with

(viewer (people "World" 'beg)

(viewer (animals "World" 'beg)

(viewer (places "World" 'beg)

The problem is that if I place point somewhere in the World buffer, point
is not repositioned at the beginning of the buffer everytime viewer is called.

--------------------

(defun viewer (list bufrn &optional pos)

"Shows list details in buffer BUFRN."

(setq actm (or actm 'end))

(with-current-buffer (get-buffer-create bufrn)

(if (eq actm 'beg) (beginning-of-buffer) (end-of-buffer)))

(princ (format "%s\n" list) (get-buffer bufrn)))

(if (eq actm 'beg) (beginning-of-buffer) (end-of-buffer))))

(pop-to-buffer bufrn))

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

* Re: Repositioning point to buffer beginning
  2022-10-22  2:04 Repositioning point to buffer beginning Heime via Users list for the GNU Emacs text editor
@ 2022-10-22  2:44 ` Emanuel Berg
  2022-10-22  6:50 ` Jean Louis
  1 sibling, 0 replies; 3+ messages in thread
From: Emanuel Berg @ 2022-10-22  2:44 UTC (permalink / raw)
  To: help-gnu-emacs

Heime via Users list for the GNU Emacs text editor wrote:

> (if (eq actm 'beg) (beginning-of-buffer) (end-of-buffer)))

(goto-char (point-min))
(goto-char (point-max))

Se the help for `beginning-of-buffer' and `end-of-buffer'.

Yes, that practice isn't optimal but it's what we have
anyway ...

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: Repositioning point to buffer beginning
  2022-10-22  2:04 Repositioning point to buffer beginning Heime via Users list for the GNU Emacs text editor
  2022-10-22  2:44 ` Emanuel Berg
@ 2022-10-22  6:50 ` Jean Louis
  1 sibling, 0 replies; 3+ messages in thread
From: Jean Louis @ 2022-10-22  6:50 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

* Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2022-10-22 05:30]:
> I am printing a list in a buffer, calling it many times with
> 
> (viewer (people "World" 'beg)
> 
> (viewer (animals "World" 'beg)
> 
> (viewer (places "World" 'beg)
> 
> The problem is that if I place point somewhere in the World buffer, point
> is not repositioned at the beginning of the buffer everytime viewer
> is called.

You may use function `goto-char', or (goto-char (point-min))


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

end of thread, other threads:[~2022-10-22  6:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-22  2:04 Repositioning point to buffer beginning Heime via Users list for the GNU Emacs text editor
2022-10-22  2:44 ` Emanuel Berg
2022-10-22  6:50 ` Jean Louis

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.