From: Lars Ingebrigtsen <larsi@gnus.org>
To: Bastian Beischer <bastian.beischer@rwth-aachen.de>
Cc: 23629@debbugs.gnu.org
Subject: bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X primary selection/clipboard
Date: Tue, 11 Aug 2020 17:07:44 +0200 [thread overview]
Message-ID: <87h7t9te4f.fsf@gnus.org> (raw)
In-Reply-To: <CAK9AuB_pdzYHGHVPjBXoEd=kV=-wZsmvE_LisYwB5S_FTg6-HQ@mail.gmail.com> (Bastian Beischer's message of "Mon, 13 Jun 2016 09:40:54 +0200")
Bastian Beischer <bastian.beischer@rwth-aachen.de> writes:
> This patch solves the issue for me.
>
> I don't know how the duplicated documentation is supposed to be
> handled. If the documentation is put on the internal function it's
> less likely to be seen, but if it is put on the two disjunct functions
> it's duplicated. What's the preferred way?
No, we usually just have the doc string in one function, and then we
refer to that function in the doc string. Like the following tweaked
patch.
This makes calc work a lot better when yanking with mouse-2, so I'd like
to include it in Emacs 28. However, it's longer than ten lines, so we
need a copyright assignment for it -- would you be willing to assign the
copyright here to the FSF?
Hm... or... is that necessary here? The patch is mostly rearranging
code, and I think if we count new lines, it's less than ten... Eli?
diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el
index f5150ca552..6cea115f76 100644
--- a/lisp/calc/calc-yank.el
+++ b/lisp/calc/calc-yank.el
@@ -150,34 +150,16 @@ math-number-regexp
;; otherwise it just parses the yanked string.
;; Modified to use Emacs 19 extended concept of kill-ring. -- daveg 12/15/96
;;;###autoload
-(defun calc-yank (radix)
- "Yank a value into the Calculator buffer.
-
-Valid numeric prefixes for RADIX: 0, 2, 6, 8
-No radix notation is prepended for any other numeric prefix.
-
-If RADIX is 2, prepend \"2#\" - Binary.
-If RADIX is 8, prepend \"8#\" - Octal.
-If RADIX is 0, prepend \"10#\" - Decimal.
-If RADIX is 6, prepend \"16#\" - Hexadecimal.
+(defun calc-yank-internal (radix thing-raw)
+ "Internal common implementation for yank functions.
-If RADIX is a non-nil list (created using \\[universal-argument]), the user
-will be prompted to enter the radix in the minibuffer.
-
-If RADIX is nil or if the yanked string already has a calc radix prefix, the
-yanked string will be passed on directly to the Calculator buffer without any
-alteration."
- (interactive "P")
+This function is used by both calc-yank and calc-yank-mouse-primary."
(calc-wrapper
(calc-pop-push-record-list
0 "yank"
(let* (radix-num
radix-notation
valid-num-regexp
- (thing-raw
- (if (fboundp 'current-kill)
- (current-kill 0 t)
- (car kill-ring-yank-pointer)))
(thing
(if (or (null radix)
;; Match examples: -2#10, 10\n(10#10,01)
@@ -232,6 +214,36 @@ calc-yank
val))
val))))))))
+;;;###autoload
+(defun calc-yank-mouse-primary (radix)
+ "Yank the current primary selection into the Calculator buffer.
+See `calc-yank' for details about RADIX."
+ (interactive "P")
+ (calc-yank-internal radix (gui-get-primary-selection)))
+
+;;;###autoload
+(defun calc-yank (radix)
+ "Yank a value into the Calculator buffer.
+
+Valid numeric prefixes for RADIX: 0, 2, 6, 8
+No radix notation is prepended for any other numeric prefix.
+
+If RADIX is 2, prepend \"2#\" - Binary.
+If RADIX is 8, prepend \"8#\" - Octal.
+If RADIX is 0, prepend \"10#\" - Decimal.
+If RADIX is 6, prepend \"16#\" - Hexadecimal.
+
+If RADIX is a non-nil list (created using \\[universal-argument]), the user
+will be prompted to enter the radix in the minibuffer.
+
+If RADIX is nil or if the yanked string already has a calc radix prefix, the
+yanked string will be passed on directly to the Calculator buffer without any
+alteration."
+ (interactive "P")
+ (calc-yank-internal radix (if (fboundp 'current-kill)
+ (current-kill 0 t)
+ (car kill-ring-yank-pointer))))
+
;;; The Calc set- and get-register commands are modified versions of functions
;;; in register.el
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2020-08-11 15:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-27 11:17 bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X primary selection/clipboard Bastian Beischer
2016-06-13 7:40 ` Bastian Beischer
2020-08-11 15:07 ` Lars Ingebrigtsen [this message]
2020-08-11 15:55 ` Eli Zaretskii
2020-08-11 16:45 ` Lars Ingebrigtsen
2020-08-12 16:04 ` Bastian Beischer
2017-01-11 10:26 ` Tino Calancha
2017-01-11 13:06 ` Bastian Beischer
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h7t9te4f.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=23629@debbugs.gnu.org \
--cc=bastian.beischer@rwth-aachen.de \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.