emacs-diffs
[Top][All Lists]
Advanced

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

master 134f4ff38b: New user option 'calc-kill-line-numbering'


From: Sean Whitton
Subject: master 134f4ff38b: New user option 'calc-kill-line-numbering'
Date: Wed, 27 Apr 2022 16:28:28 -0400 (EDT)

branch: master
commit 134f4ff38b323af8892520200307e9d54ae90200
Author: Sean Whitton <spwhitton@spwhitton.name>
Commit: Sean Whitton <spwhitton@spwhitton.name>

    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 copied text (bug#55133).
    * 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 @@ with no argument copies only the number itself into 
the kill ring, whereas
 @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 e7502b1f16..70087f2629 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1311,6 +1311,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-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 523f51533a..b03dcfeb5b 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -439,6 +439,14 @@ to be identified as that note."
   :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



reply via email to

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