unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Boruch Baum <boruch_baum@gmx.com>
Cc: 30085@debbugs.gnu.org, Kim Storm <storm@cua.dk>
Subject: bug#30085: 25.2: Documentation for cua-rectangle-mark-mode
Date: Mon, 26 Oct 2020 18:50:35 -0700	[thread overview]
Message-ID: <CADwFkmm3Yd3eoXV+QUHirtUmNdKHw106D=fusr-E5DcEU2Y20Q@mail.gmail.com> (raw)
In-Reply-To: <20180321124836.puwmknqvo6zketnk@E15-2016.optimum.net> (Boruch Baum's message of "Wed, 21 Mar 2018 08:48:36 -0400")

[-- Attachment #1: Type: text/plain, Size: 2363 bytes --]

Boruch Baum <boruch_baum@gmx.com> writes:

> 1. The docstring issue, until I realized I should ask.

Thanks, I've pushed that part to master in your name with some
touch-ups.  I also added a ChangeLog entry.  See commit cfc70e51c2 on
the master branch.

> 2. @Kim: At the end of the first diff block, I noted an issue about the
>   `cua--last-killed-rectangle' data structure. Could you set me right
>    about it?

I left this as a FIXME comment, since it doesn't seem like anyone knows
the answer.  Hopefully someone so inclined will take a closer look at
some point.

> 3. I noticed that `M-m' was bound to `cua-copy-rectangle-as-text'
>    instead of `back-to-indentation', so I took the liberty of writing a
>    function `cua-resize-rectangle-back-to-indentation' and binding it to
>    `M-m', which is what most users would expect. If this approved, to
>    what should be bound `cua-copy-rectangle-as-text'
>
> 4. Function `cua-resize-rectangle-bot' had a bug in that it always
>    placed point at the actual (point-max) even though the rectangle
>    corner would not be there. This would occur when (point-max) was at a
>    column number smaller than the left edge of the rectangle. The patch
>    file includes the fix.
>
> 5. Two commonly used navigation functions, normally bound to `C-a' and
>    `C-e' were not remapped. (DONE)

Could you please provide instructions for how to test the above parts?
I don't use this mode and it's not clear to me what to do.  Also, could
you perhaps split the patch up and make it clear which parts of your
code belong to which of the above points?

Ideally, if possible, you would also add ChangeLog entries as per
etc/CONTRIBUTE.

> 6. The help message is remapped from `C-?' to `M-?' for the sanity of
>    people like me who use emacs-nox and can only perform a `C-?' by
>    typing `C-x @ c ?'.

I don't understand which part of your patch this refers to, or how to
test it.  Could you please clarify?

> 7. The current keybindings are made using an old method of keystroke
>    definition that I find a bit scary. Is it OK / desirable to change
>    the method uniformly to use `kbd'?

I have no strong opinion on this, but it seems relatively minor.  Perhaps
it's not worth the code churn.

> First slow steps.

I've attached a diff with the parts of your patch that I didn't yet push
to master.

Thanks.

[-- Attachment #2: bug30085-left-out.diff --]
[-- Type: text/x-diff, Size: 2760 bytes --]

diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el
index 7ca9dc1af1..52cdcd9767 100644
--- a/lisp/emulation/cua-rect.el
+++ b/lisp/emulation/cua-rect.el
@@ -423,10 +423,23 @@ cua-resize-rectangle-bol
         (cua--rectangle-corner -1))
     (cua--rectangle-resized)))
 
+(defun cua-resize-rectangle-back-to-indentation ()
+  "Resize rectangle to first non-whitespace character on the left."
+  (interactive)
+  (unless (bolp)
+    (back-to-indentation)
+    (cua--rectangle-left (current-column))
+    (if (cua--rectangle-right-side)
+        (cua--rectangle-corner -1))
+    (cua--rectangle-resized)))
+
 (defun cua-resize-rectangle-bot ()
   "Resize rectangle to bottom of buffer."
   (interactive)
   (goto-char (point-max))
+  (let ((col (cua--rectangle-column)))
+    (when (< (current-column) col)
+      (cua--forward-line -1)))
   (move-to-column (cua--rectangle-column))
   (cua--rectangle-bot t)
   (cua--rectangle-resized))
@@ -1503,6 +1516,8 @@ cua--init-rectangles
   (define-key cua--rectangle-keymap [remap previous-line]       'cua-resize-rectangle-up)
   (define-key cua--rectangle-keymap [remap end-of-line]         'cua-resize-rectangle-eol)
   (define-key cua--rectangle-keymap [remap beginning-of-line]   'cua-resize-rectangle-bol)
+  (define-key cua--rectangle-keymap [remap move-end-of-line]       'cua-resize-rectangle-eol)
+  (define-key cua--rectangle-keymap [remap move-beginning-of-line] 'cua-resize-rectangle-bol)
   (define-key cua--rectangle-keymap [remap end-of-buffer]       'cua-resize-rectangle-bot)
   (define-key cua--rectangle-keymap [remap beginning-of-buffer] 'cua-resize-rectangle-top)
   (define-key cua--rectangle-keymap [remap scroll-down]         'cua-resize-rectangle-page-up)
@@ -1522,7 +1537,7 @@ cua--init-rectangles
   (define-key cua--rectangle-keymap "\r"     'cua-rotate-rectangle)
   (define-key cua--rectangle-keymap "\t"     'cua-indent-rectangle)
 
-  (define-key cua--rectangle-keymap [(control ??)] 'cua-help-for-rectangle)
+  (define-key cua--rectangle-keymap (kbd "M-?") 'cua-help-for-rectangle)
 
   (define-key cua--rectangle-keymap [mouse-1]	   'cua-mouse-set-rectangle-mark)
   (define-key cua--rectangle-keymap [down-mouse-1] 'cua--mouse-ignore)
@@ -1547,6 +1562,9 @@ cua--init-rectangles
   (cua--rect-M/H-key ?k	'cua-cut-rectangle-as-text)
   (cua--rect-M/H-key ?l	'cua-downcase-rectangle)
   (cua--rect-M/H-key ?m	'cua-copy-rectangle-as-text)
+; (cua--rect-M/H-key ?m	'cua-copy-rectangle-as-text) ;; TBD
+  (define-key cua--rectangle-keymap [remap back-to-indentation] 'cua-resize-rectangle-back-to-indentation)
+
   (cua--rect-M/H-key ?n	'cua-sequence-rectangle)
   (cua--rect-M/H-key ?o	'cua-open-rectangle)
   (cua--rect-M/H-key ?p	'cua-toggle-rectangle-virtual-edges)

  reply	other threads:[~2020-10-27  1:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12  7:14 bug#30085: 25.2: Documentation for cua-rectangle-mark-mode Boruch Baum
2018-01-12  9:22 ` Eli Zaretskii
2018-01-12 11:00   ` Kim Storm
2018-01-12 18:53     ` Eli Zaretskii
2018-01-26 18:57       ` Boruch Baum
2018-03-21 12:48       ` Boruch Baum
2020-10-27  1:50         ` Stefan Kangas [this message]
2020-10-28  6:40           ` Boruch Baum
2020-12-16  7:43           ` Boruch Baum
2018-01-12 11:06   ` Kim Storm
2019-10-19  1:21 ` Stefan Kangas
2019-10-19  6:39   ` Eli Zaretskii
2020-10-27  1:39     ` Stefan Kangas
2019-10-23 10:56   ` Boruch Baum
2019-10-23 11:10     ` Stefan Kangas
2019-10-28 10:41       ` Lars Ingebrigtsen
2019-10-28 16:11         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkmm3Yd3eoXV+QUHirtUmNdKHw106D=fusr-E5DcEU2Y20Q@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=30085@debbugs.gnu.org \
    --cc=boruch_baum@gmx.com \
    --cc=storm@cua.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).