From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs 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 Message-ID: <87h7t9te4f.fsf@gnus.org> References: <874m9j21is.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="842"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 23629@debbugs.gnu.org To: Bastian Beischer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 11 17:08:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5Vsn-000AaQ-UL for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 11 Aug 2020 17:08:10 +0200 Original-Received: from localhost ([::1]:44496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5Vsn-00010d-1D for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 11 Aug 2020 11:08:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5Vsg-00010W-QB for bug-gnu-emacs@gnu.org; Tue, 11 Aug 2020 11:08:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k5Vsg-0007y4-HS for bug-gnu-emacs@gnu.org; Tue, 11 Aug 2020 11:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k5Vsg-0006q3-C1 for bug-gnu-emacs@gnu.org; Tue, 11 Aug 2020 11:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 Aug 2020 15:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23629 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 23629-submit@debbugs.gnu.org id=B23629.159715848126281 (code B ref 23629); Tue, 11 Aug 2020 15:08:02 +0000 Original-Received: (at 23629) by debbugs.gnu.org; 11 Aug 2020 15:08:01 +0000 Original-Received: from localhost ([127.0.0.1]:41410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5Vsf-0006po-CS for submit@debbugs.gnu.org; Tue, 11 Aug 2020 11:08:01 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:33470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5Vsc-0006pW-5C for 23629@debbugs.gnu.org; Tue, 11 Aug 2020 11:08:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=K78FR1bWK2H7hBhZgWls6GZmE78h03rZs1E9cYvYMEU=; b=kyRmanjQr78RmRqwuusU/xi16N su6rXBZ0XAfbhqV0anF4THRFwufTawzT4JMarbp4JJDaCyczDVXO/Y7YwGcbKfSyLXRXA9GxytYHn CuTw1eJQdinlw5BrgrhBrt7NVicadQs8pcLRUlxy9sgFi2P5EG0/rh8loF2vP2Lc0q10=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5VsP-0005Pv-Ny; Tue, 11 Aug 2020 17:07:51 +0200 In-Reply-To: (Bastian Beischer's message of "Mon, 13 Jun 2016 09:40:54 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:184663 Archived-At: Bastian Beischer 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