unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#55133: 29.0.50; calc kill commands should be customisable not to include line numbering
@ 2022-04-26 18:54 Sean Whitton
  2022-04-27 13:01 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Whitton @ 2022-04-26 18:54 UTC (permalink / raw)
  To: 55133

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

Tags: patch

Hello,

I'd like to add a new user option to exclude line numbering from the
primary calc kill and copy commands.  Usually what you want to have in
the kill ring is just the number.  Patch attached.

-- 
Sean Whitton

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-New-user-option-calc-kill-line-numbering.patch --]
[-- Type: text/x-patch, Size: 2870 bytes --]

From 81f88eb5fe76c2e75d3dd04dc77ca36a03d0a308 Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhitton@spwhitton.name>
Date: Tue, 26 Apr 2022 11:39:38 -0700
Subject: [PATCH] New user option 'calc-kill-line-numbering'

* lisp/calc/calc.el (calc-kill-line-numbering): New defcustom.
* lisp/calc/calc-yank.el (calc-kill): Unless calc-kill-line-numbering
is non-nil, do not include line numbering in text copied to kill ring.
* etc/NEWS:
* doc/misc/calc.texi (Killing from the Stack): Document the change.
---
 doc/misc/calc.texi     | 6 ++++++
 etc/NEWS               | 6 ++++++
 lisp/calc/calc-yank.el | 2 ++
 lisp/calc/calc.el      | 8 ++++++++
 4 files changed, 22 insertions(+)

diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index d83edc15f3..9bda6af1c5 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -29877,6 +29877,12 @@ Killing From Stack
 @kbd{C-k} with a prefix argument of 1 copies the number with its trailing
 newline.
 
+You can customize @code{calc-kill-line-numbering} to nil to exclude
+line numbering from kills and copies made by @code{calc-kill} and
+@code{calc-copy-as-kill}.  This option does not affect calc kill and
+copy commands which operate on the region, as that would not make
+sense.
+
 @node Yanking Into Stack
 @section Yanking into the Stack
 
diff --git a/etc/NEWS b/etc/NEWS
index c0b9ce654e..b462d02efd 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1261,6 +1261,12 @@ Lisp function.  This frees you from having to keep track of whether
 commands are Lisp function or external when supplying absolute file
 name arguments.  See "Electric forward slash" in the Eshell manual.
 
+** Calc
+
++++
+*** New user option 'calc-kill-line-numbering'.
+This can be set to nil to exclude line numbering from kills and copies.
+
 ** Miscellaneous
 
 +++
diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el
index 8c6d3f51e5..172ccf1adc 100644
--- a/lisp/calc/calc-yank.el
+++ b/lisp/calc/calc-yank.el
@@ -47,6 +47,8 @@ calc-kill
          (calc-check-stack num)
 	 (let ((stuff (calc-top-list n (- num n -1))))
 	   (calc-cursor-stack-index num)
+           (unless calc-kill-line-numbering
+             (re-search-forward "\\=[0-9]+:\\s-+" (point-at-eol) t))
 	   (let ((first (point)))
 	     (calc-cursor-stack-index (- num n))
 	     (if (null nn)
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 2c139a0238..725a2b0075 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -439,6 +439,14 @@ calc-note-threshold
   :version "24.1"
   :type 'string)
 
+(defcustom calc-kill-line-numbering t
+  "If non-nil, calculator kills include any line numbering.
+
+This option does not affect calc kill and copy commands which
+operate on the region, such as `calc-copy-region-as-kill'."
+  :version "29.1"
+  :type 'boolean)
+
 (defvar math-format-date-cache) ; calc-forms.el
 
 (defface calc-nonselected-face
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#55133: 29.0.50; calc kill commands should be customisable not to include line numbering
  2022-04-26 18:54 bug#55133: 29.0.50; calc kill commands should be customisable not to include line numbering Sean Whitton
@ 2022-04-27 13:01 ` Lars Ingebrigtsen
  2022-04-27 20:28   ` Sean Whitton
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-27 13:01 UTC (permalink / raw)
  To: Sean Whitton; +Cc: 55133

Sean Whitton <spwhitton@spwhitton.name> writes:

> I'd like to add a new user option to exclude line numbering from the
> primary calc kill and copy commands.  Usually what you want to have in
> the kill ring is just the number.  Patch attached.

Makes sense to me; go ahead and push.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#55133: 29.0.50; calc kill commands should be customisable not to include line numbering
  2022-04-27 13:01 ` Lars Ingebrigtsen
@ 2022-04-27 20:28   ` Sean Whitton
  0 siblings, 0 replies; 3+ messages in thread
From: Sean Whitton @ 2022-04-27 20:28 UTC (permalink / raw)
  To: 55133-done

Hello,

On Wed 27 Apr 2022 at 03:01PM +02, Lars Ingebrigtsen wrote:

> Sean Whitton <spwhitton@spwhitton.name> writes:
>
>> I'd like to add a new user option to exclude line numbering from the
>> primary calc kill and copy commands.  Usually what you want to have in
>> the kill ring is just the number.  Patch attached.
>
> Makes sense to me; go ahead and push.

Thanks for looking it over.

-- 
Sean Whitton





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-27 20:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-26 18:54 bug#55133: 29.0.50; calc kill commands should be customisable not to include line numbering Sean Whitton
2022-04-27 13:01 ` Lars Ingebrigtsen
2022-04-27 20:28   ` Sean Whitton

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).