[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: transient-mark-mode



>> On Tue, 12 Jan 1999 15:28:38 +0900 (JST)
>> [ito] Toru Ito <ito@xxxxxxxxxxxxxxxxxxxxxxxxx> said:

ito>  ところが、同じ操作をMeadowで行うと…
ito>  1.C-SPC→C-n、C-n、C-n…で範囲を指定すると.emacsに
ito>            ;;リージョンをハイライト
ito>            (transient-mark-mode t)
ito>    が書いてあるので指定範囲が色付けされます。
ito>  2.その後、例えばM-wとすると、文章はそのままで色付けも消えません。
ito>                                               ^^^^^^^^^^^^^^^^^^


おいらの場合は、以下のような関数を作って、 \M-w に割り当ててしまいましたが・・・


~/.emacs
(load "my-kill-ring-save")
(global-set-key "\M-w" 'my-kill-ring-save)



~/lisp/my-kill-ring-save.el
;;;
;;; \M-w でハイライト領域を解除する
;;;        (最後の3行を付け加えただけですが ^^;)
;;;
;;;                       by H.Kamihara 1998.02
;;;           
(defun my-kill-ring-save (beg end)
  (interactive "r")
  (copy-region-as-kill beg end)
  (if (interactive-p)
      (let ((other-end (if (= (point) beg) end beg))
	    (opoint (point))
	    ;; Inhibit quitting so we can make a quit here
	    ;; look like a C-g typed as a command.
	    (inhibit-quit t))
	(if (pos-visible-in-window-p other-end (selected-window))
	    (progn
	      ;; Swap point and mark.
	      (set-marker (mark-marker) (point) (current-buffer))
	      (goto-char other-end)
	      (sit-for 1)
	      ;; Swap back.
	      (set-marker (mark-marker) other-end (current-buffer))
	      (goto-char opoint)
	      ;; If user quit, deactivate the mark
	      ;; as C-g would as a command.
	      (and quit-flag mark-active
		   (deactivate-mark))))))
  ;;
  (cond 
   (mark-active
    (deactivate-mark))))

-------------------------
神原久夫 (KAMIHARA Hisao)
mailto:kami@xxxxxxxxx