all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Selected region not visible
@ 2010-03-13 20:06 Johan Andersson
  2010-03-13 20:15 ` Lennart Borgman
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Andersson @ 2010-03-13 20:06 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 447 bytes --]

Hey,

I'm trying to select a region using set-mark and goto-char. It works, except
that I do not see the region. This simple test function for example will
select the region, but not highlight it.

(defun test ()
  (interactive)
  (let ((region (buffer-substring-no-properties (point) (mark))))
    (delete-region (point) (mark))
    (forward-char 1)
    (insert region)
    (set-mark 2)
    (goto-char 20)))

Any idea why that might be?

Thanks!

[-- Attachment #2: Type: text/html, Size: 849 bytes --]

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

* Re: Selected region not visible
  2010-03-13 20:06 Selected region not visible Johan Andersson
@ 2010-03-13 20:15 ` Lennart Borgman
  2010-03-13 21:46   ` Johan Andersson
  0 siblings, 1 reply; 3+ messages in thread
From: Lennart Borgman @ 2010-03-13 20:15 UTC (permalink / raw)
  To: Johan Andersson; +Cc: help-gnu-emacs

On Sat, Mar 13, 2010 at 9:06 PM, Johan Andersson <johan.rejeep@gmail.com> wrote:
> (defun test ()
>   (interactive)
>   (let ((region (buffer-substring-no-properties (point) (mark))))
>     (delete-region (point) (mark))
>     (forward-char 1)
>     (insert region)
>     (set-mark 2)
>     (goto-char 20)))

You need to add

  (setq deactivate-mark nil)




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

* Re: Selected region not visible
  2010-03-13 20:15 ` Lennart Borgman
@ 2010-03-13 21:46   ` Johan Andersson
  0 siblings, 0 replies; 3+ messages in thread
From: Johan Andersson @ 2010-03-13 21:46 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 511 bytes --]

Ohh... didn't know of that. Thanks Lennart!

On Sat, Mar 13, 2010 at 8:15 PM, Lennart Borgman
<lennart.borgman@gmail.com>wrote:

> On Sat, Mar 13, 2010 at 9:06 PM, Johan Andersson <johan.rejeep@gmail.com>
> wrote:
> > (defun test ()
> >   (interactive)
> >   (let ((region (buffer-substring-no-properties (point) (mark))))
> >     (delete-region (point) (mark))
> >     (forward-char 1)
> >     (insert region)
> >     (set-mark 2)
> >     (goto-char 20)))
>
> You need to add
>
>  (setq deactivate-mark nil)
>

[-- Attachment #2: Type: text/html, Size: 891 bytes --]

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

end of thread, other threads:[~2010-03-13 21:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-13 20:06 Selected region not visible Johan Andersson
2010-03-13 20:15 ` Lennart Borgman
2010-03-13 21:46   ` Johan Andersson

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.