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

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

Re: how to highlight the mark


From: Patrick Gundlach
Subject: Re: how to highlight the mark
Date: Tue, 11 Nov 2003 13:30:34 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (darwin)

Wim Yedema <yedema@natlab.research.philips.com> writes:

> Subject says it all really.  I want to highlight the mark kind of like 
> the cursor.

thats what I use:


;; nice mark - shows mark as a highlighted 'cursor' so user 'always' 
;; sees where the mark is. Especially nice for killing a region.

(defvar pg-mark-overlay nil
  "Overlay to show the position where the mark is") 
(make-variable-buffer-local 'pg-mark-overlay)

(put 'pg-mark-mark 'face 'secondary-selection)

(defvar pg-mark-old-position nil
  "The position the mark was at. To be able to compare with the
current position")

(defun pg-show-mark () 
  "Display an overlay where the mark is at. Should be hooked into 
activate-mark-hook" 
  (unless pg-mark-overlay 
    (setq pg-mark-overlay (make-overlay 0 0))
    (overlay-put pg-mark-overlay 'category 'pg-mark-mark))
  (let ((here (mark t)))
    (when here
      (move-overlay pg-mark-overlay here (1+ here)))))

(defadvice  exchange-point-and-mark (after pg-mark-exchange-point-and-mark)
  "Show visual marker"
  (pg-show-mark))

(ad-activate 'exchange-point-and-mark)
(add-hook 'activate-mark-hook 'pg-show-mark)



Patrick
-- 
You are your own rainbow!


reply via email to

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