help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: leaving the region highlighted after a command


From: Drew Adams
Subject: RE: leaving the region highlighted after a command
Date: Thu, 7 Jun 2007 07:30:21 -0700

> > (defun foo ()
> >   (when (not executing-kbd-macro) (setq deactivate-mark nil)))
> >
> > In general, see the Elisp manual for `deactivate-mark'.
>
> That did it! I still don't understand why my mb function doesn't work
> above, when all it does is call mark-whole-buffer...but adding
> deactivate-mark fixed it.

Did you "see the Elisp manual for `deactivate-mark'?"? That explains that

    "If an editor command sets this variable non-`nil', then the editor
     command loop deactivates the mark after the command returns (if
     Transient Mark mode is enabled).  All the primitives that change
     the buffer set `deactivate-mark', to deactivate the mark when the
     command is finished.
     To write Lisp code that modifies the buffer without causing
     deactivation of the mark at the end of the command, bind
     `deactivate-mark' to `nil' around the code that does the
     modification."

IOW, your code did not work because the marke was automatically deactivated
after your command returned.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]