emacs-devel
[Top][All Lists]
Advanced

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

Re: delete-selection-mode as default


From: Elias Mårtenson
Subject: Re: delete-selection-mode as default
Date: Fri, 14 Sep 2018 23:15:01 +0800

On Fri, 14 Sep 2018 at 21:43, Yuri Khan <address@hidden> wrote:
 
One other thing that I want is that the region be highlighted if and
only if it is going to be the target of the next command I give,
because I like to look before I leap. It seems transient-mark-mode is
intended to give me this by adding the concept of active region and
highlighting the region when it is active. However, many commands act
on the region even if it is inactive. kill-region and
copy-region-as-kill are two such commands. I am sure there are many
more, because it is much easier to write:

(defun my-command (BEGIN END)
  (interactive "r")
  ;; do something between BEGIN and END
)

than:

(defun my-command (BEGIN END)
  (interactive (if (use-region-p)
                   (list (min (point) (mark)) (max (point) (mark)))
                 ;; figure out what to do when no region is active
                 ;; * act on the whole buffer
                 ;; * act on the current narrowing
                 ;; * signal an error
                 ;; * do something else sensible
                 (list ?? ??)))
  ;; do something between BEGIN and END
)

I've seen functions implemented like that, and I would consider those buggy. It's going directly against the concept of the point and mark as being the region. I know some people want the same behaviour as gedit or whatever editor is default in desktop environments these days, but the Emacs way really is powerful and it would be useful if people who want to change things at least understood this concept first.

Regards,
Elias

reply via email to

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