all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to create new buffer with t-m-m active region?
@ 2010-09-04 18:38 Dan Davison
  2010-09-05  0:25 ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Davison @ 2010-09-04 18:38 UTC (permalink / raw)
  To: help-gnu-emacs mailing list

How would I generate a new buffer containing an active region such that
the next command issued in the new buffer will act on the region? (And
so that the region is highlighted)

For example, this function doesn't do what it wants to do:

(defun new-buffer-w-active-region ()
  (interactive)
  (let ((transient-mark-mode t))
    (switch-to-buffer (get-buffer-create "region-test"))
    (delete-region (point-min) (point-max))
    (insert "I want these lines\n")
    (insert "to be in an active region with t-m-m on\n")
    (insert "such that comment-region comments them out\n")
    (emacs-lisp-mode)
    (push-mark (point-min) nil 'activate)))


With that function, the following doesn't do what is intended:

M-x new-buffer-w-active-region
M-;

Thanks,

Dan



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

end of thread, other threads:[~2010-09-05  3:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.7.1283625538.1782.help-gnu-emacs@gnu.org>
2010-09-04 23:01 ` How to create new buffer with t-m-m active region? Stefan Monnier
2010-09-04 18:38 Dan Davison
2010-09-05  0:25 ` Drew Adams
2010-09-05  3:47   ` Dan Davison

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.