emacs-devel
[Top][All Lists]
Advanced

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

Re: visual-region-mode?


From: hw
Subject: Re: visual-region-mode?
Date: Wed, 19 Sep 2018 03:45:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

address@hidden (Charles A. Roelli) writes:

>> From: hw <address@hidden>
>> Date: Mon, 17 Sep 2018 22:36:30 +0200
>>
>> Having clarified which operations can be used with a region doesn't mean
>> that working with a region can be efficiently done.
>
> It does for me.  For example, see the output of M-x -region TAB.  By
> just knowing a smidgeon of these commands, you can work very
> efficiently with a region, with all the documentation and help Emacs
> provides.

That's like saying it doesn't matter how inefficient a procedure is if
you only have some instructions to perform it.

> If we somehow "disarm" the region by default (as you have
> suggested), the use of all these commands would be less efficient.

That was Elis idea, and it doesn't refer to commands implying "region"
but, IIUC, to how to deal with that users might sometimes want to delete
a region by inserting characters and sometimes not.

>> > The "hidden regions" can only be a source of error if you type, say,
>> > C-w or M-w at random during editing.
>> 
>> What about upcase-region, downcase-region and others that don't come to
>> mind atm?  They already clash with transient-mark-mode and are as unsafe
>> as C-w and M-w.  Changing mark-even-if-inactive to nil is required to
>> prevent that --- why isn't that the default?
>
> These commands are already disabled by default.

Right, I didn't notice.  Emacs says they are disabled because they can
be confusing.  Confusing usually doesn't exactly mean efficient.

>> The hidden regions mean that I always have to consider that they are
>> always there so that I do not make a mistake in the first place.  That
>> makes me feel uneasy.
>
> What's the worst that could happen?  We have so many ways to recover
> from these sorts of errors: autosaves, backups, VC,
> diff-buffer-with-file, ...

An accidental downcase-region of a couple lines in a program usually
isn't very noticeable unless you look very closely at it, so chances
aren't too bad that the problems they may cause only come up when it
means that the worst thing does happen.

> In addition, for buffers that you think should have additional
> protection against accidental edits, there's "view-mode".

Well, I have delete-active-region and mark-even-if-inactive set to nil
and am testing this:


(defun my-exchange-point-and-mark (&optional arg)
  "Put the mark where point is now, and point where the mark is
now.  With a prefix argument, toggle the activeness of the
region.

This function itself is ignorant of `transient-mark-mode'."
  (interactive "P")
  (let ((omark (marker-position (mark-marker))))
    (if (null omark)
        (user-error "No mark set in this buffer"))
    (set-marker (mark-marker) (point))
    (goto-char omark))
  (if arg
      (if mark-active (deactivate-mark)
        (activate-mark t))))


Now I have the region fortified and am able to use the mark for
navigation without making (or unmaking) a selection from the region
unless I actually want to.  I just wish the mark was visible and point
was indicating the direction of it.

View-mode is cool for things not being edited.



reply via email to

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