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

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

leaving the region highlighted after a command


From: Jonathan Swartz
Subject: leaving the region highlighted after a command
Date: Wed, 6 Jun 2007 06:24:15 -0700

I use transient-mark-mode. I'm trying to write a command like mark- whole-buffer that selects a certain region and leaves it highlighted. But I cannot seem to get this to work; at the end of my command, the region is never highlighted.

Here's the definition of mark-whole-buffer in simple.el:

   (defun mark-whole-buffer ()
     "Put point at beginning and mark at end of buffer.
   You probably should not use this function in Lisp programs;
   it is usually a mistake for a Lisp function to use any subroutine
   that uses or sets the mark."
     (interactive)
     (push-mark (point))
     (push-mark (point-max) nil t)
     (goto-char (point-min)))

This leaves the region highlighted. But if I simply call mark-whole- buffer from another function or copy its code verbatim to another function, the new other functions do NOT leave the region highlighted:

   ;; No highlighting
   (defun mb ()
     (interactive)
     (mark-whole-buffer))

   ;; Yup, still no highlighting
   (defun mb2 ()
     "Put point at beginning and mark at end of buffer.
   You probably should not use this function in Lisp programs;
   it is usually a mistake for a Lisp function to use any subroutine
   that uses or sets the mark."
     (interactive)
     (push-mark (point))
     (push-mark (point-max) nil t)
     (goto-char (point-min)))

So is there something magical about mark-whole-buffer that isn't evident in the source? e.g. is it on a list of functions somewhere to leave the region highlighted?

I've reproduced this on both Emacs 22.0.50.1 on OS X, and Emacs 21.3.1 on RHEL4.

Any help much appreciated,
Jon





reply via email to

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