GNU bug report logs - #23629
25.0.94; Calc: Yanking with mouse-2 does not use X primary selection/clipboard

Previous Next

Package: emacs;

Reported by: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>

Date: Fri, 27 May 2016 11:18:01 UTC

Severity: normal

Tags: fixed, moreinfo, patch

Found in version 25.0.94

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23629 in the body.
You can then email your comments to 23629 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23629; Package emacs. (Fri, 27 May 2016 11:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bastian Beischer <bastian.beischer <at> rwth-aachen.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 27 May 2016 11:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.94;
 Calc: Yanking with mouse-2 does not use X primary selection/clipboard
Date: Fri, 27 May 2016 13:17:31 +0200
I have customized 'select-enable-primary' to 't' and I'm using it to
paste the X primary selection with 'mouse-2' often. This invokes
mouse-yank-primary and that works fine.

It does not work well in calc, though. In calc mouse-2 is bound to
calc-yank, which takes the thing to be yanked from the kill-ring.

I think it would be appropriate to add a dedicated function
"calc-yank-mouse" which forwards the data obtained by
'gui-selection-value' to 'calc-yank'.

I'm not sure that 'gui-selection-value' is the correct function: What I
mean is 'a function which respects 'select-enable-primary' and
'select-enable-clipboard' and returns the right thing from the
corresponding X buffer'.

To reproduce:

1) emacs -Q
2) M-x calc
3) Select a number in some other X window (xterm for example) with the
   mouse
4) Go back to emacs *calc* buffer and press mouse-2.



In GNU Emacs 25.0.94.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.6)
 of 2016-05-25 built on beischer-w520
Repository revision: 897fb6fa49d5ffc85f0a796e7414a43ef05ad096
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-sound=alsa --with-xft --with-modules --with-x-toolkit=gtk3
 --without-gconf --with-gsettings 'CFLAGS=-march=native -O2 -pipe
 -fstack-protector-strong' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  projectile-global-mode: t
  projectile-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  window-numbering-mode: t
  company-mode: t
  diff-auto-refine-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  flx-ido-mode: t
  ido-everywhere: t
  global-srecode-minor-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-idle-scheduler-mode: t
  global-semantic-decoration-mode: t
  global-semantic-highlight-func-mode: t
  global-semantic-stickyfunc-mode: t
  global-semantic-show-parser-state-mode: t
  semantic-mode: t
  global-ede-mode: t
  shell-dirtrack-mode: t
  show-paren-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  hs-minor-mode: t

Recent messages:
.emacs.d/cedet/lisp/cedet/ede/loaddefs.el: Obsolete name arg "lein2" to constructor ede-project-autoload
.emacs.d/cedet/lisp/cedet/ede/loaddefs.el: Obsolete name arg "linux" to constructor ede-project-autoload
.emacs.d/cedet/lisp/cedet/ede/loaddefs.el: Obsolete name arg "maven2" to constructor ede-project-autoload
Parsing  *srecode-map-tmp* (LALR)...done
Loading /home/beischer/.emacs.d/cedet/cedet-devel-load.el (source)...done
ad-handle-definition: ‘ido-completing-read’ got redefined
Loading buff-menu...done
ad-handle-definition: ‘add-log-current-defun’ got redefined
Turning on magit-auto-revert-mode...done
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
/home/beischer/.emacs.d/cedet/lisp/speedbar/loaddefs hides /home/beischer/.emacs.d/cedet/lisp/cedet/loaddefs
/home/beischer/.emacs.d/elpa/helm-20160526.248/helm-multi-match hides /home/beischer/.emacs.d/elpa/helm-core-20160526.349/helm-multi-match
/home/beischer/.emacs.d/elpa/cmake-mode-20160510.1140/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/usr/share/emacs/site-lisp/various/buff-menu hides /usr/share/emacs/25.0.94/lisp/buff-menu
/home/beischer/.emacs.d/cedet/lisp/speedbar/loaddefs hides /usr/share/emacs/25.0.94/lisp/loaddefs
/home/beischer/.emacs.d/elpa/emms-20160304.920/tq hides /usr/share/emacs/25.0.94/lisp/emacs-lisp/tq

Features:
(shadow sort mail-extr emacsbug sendmail company-oddmuse
company-keywords company-etags company-gtags company-dabbrev-code
company-dabbrev company-files company-capf company-cmake company-xcode
company-clang company-semantic company-eclim company-template
company-css company-nxml company-bbdb company-edbi edbi sql view jedi
jedi-core python-environment epc ctable concurrent deferred
auto-complete popup cmake-project gist gh-gist gh-oauth gh-api logito
gh-cache pcache gh-auth gh-common gh-url url-http tls gnutls url-auth
url-gw gh-profile json map timezone org-install tempo url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util url-parse url-vars mailcap xml-parse doxymacs projectile
ibuf-ext ibuffer dropdown-list yasnippet cl my-term term disp-table
ehelp etags-table etags xref project cmake-mode thingatpt rx qt-pro
pastebin window-numbering company magit-topgit magit-blame magit-stash
magit-bisect magit-remote magit-commit epa magit-sequence magit esh-var
esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg esh-groups eshell
esh-module esh-mode esh-util magit-apply magit-wip magit-log magit-diff
smerge-mode diff-mode magit-core magit-autorevert autorevert filenotify
magit-process magit-popup magit-mode derived magit-git crm magit-section
magit-utils git-commit log-edit message idna rfc822 mml mml-sec epg
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
with-editor async-bytecomp easy-mmode async tramp-sh server hide-lines
buff-menu+ hideshow flx-ido flx ido dired-x dired ede/cpp-root
srecode/mode semantic/senator srecode/insert srecode/filters
srecode/args semantic/db-mode f dash s semantic/bovine/c hideif
semantic/bovine/c-by semantic/lex-spp semantic/idle working fame
semantic/bovine/gcc semantic/dep semantic/bovine semantic/analyze/refs
semantic/decorate/include semantic/db-find semantic/db-ref
semantic/decorate/mode semantic/decorate pulse cedet-devel-load
cogre/srecode cogre cogre/picture-hack rect picture eieio-opt find-func
srecode/find srecode/map semantic/edit srecode/srt-mode srecode/template
srecode/srt-wy semantic/wisent semantic/wisent/wisent srecode/ctxt
srecode/compile srecode/dictionary srecode/table srecode
semantic/canned-configs semantic/ia-sb semantic/analyze semantic/sort
semantic/scope semantic/analyze/fcn semantic/db semantic/ctxt
semantic/format semantic/tag-ls semantic/find semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
sb-info ede/speedbar ede/files ede ede/detect ede/base ede/auto
ede/source eieio-compat eieio-base eieio-speedbar speedbar sb-image
ezimage dframe eieio-custom wid-edit cedet cedet-compat inversion
cedet-remove-builtin cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs flymake finder-inf tex-site
info package epg-config seq vc-cvs tramp tramp-compat auth-source cl-seq
eieio byte-opt bytecomp byte-compile cl-extra cconv eieio-core cl-macs
gv gnus-util mm-util help-fns help-mode easymenu mail-prsvr
password-cache tramp-loaddefs trampver ucs-normalize shell pcomplete
format-spec advice edmacro kmacro cl-loaddefs pcase cl-lib emacs-x-theme
paren grep compile comint ansi-color ring linum hi-lock cus-start
cus-load time-date mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame
cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 614175 16718)
 (symbols 48 51346 53)
 (miscs 40 87 180)
 (strings 32 120506 20978)
 (string-bytes 1 3736110)
 (vectors 16 72174)
 (vector-slots 8 1281781 10649)
 (floats 8 1544 163)
 (intervals 56 402 0)
 (buffers 976 14)
 (heap 1024 50297 2436))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23629; Package emacs. (Mon, 13 Jun 2016 07:42:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: 25.0.94;
 Calc: Yanking with mouse-2 does not use X primary selection/clipboard
Date: Mon, 13 Jun 2016 09:40:54 +0200
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?

--- a/calc-yank.el.bak 2016-06-13 09:25:24.376509910 +0200
+++ b/calc-yank.el 2016-06-13 09:26:18.824226799 +0200
@@ -150,34 +150,16 @@
 ;; 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,50 @@
                       val))
                 val))))))))

+;;;###autoload
+(defun calc-yank-mouse-primary (radix)
+  "Yank the current primary selection 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 (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


On Fri, May 27, 2016 at 1:17 PM, Bastian Beischer
<bastian.beischer <at> rwth-aachen.de> wrote:
>
> I have customized 'select-enable-primary' to 't' and I'm using it to
> paste the X primary selection with 'mouse-2' often. This invokes
> mouse-yank-primary and that works fine.
>
> It does not work well in calc, though. In calc mouse-2 is bound to
> calc-yank, which takes the thing to be yanked from the kill-ring.
>
> I think it would be appropriate to add a dedicated function
> "calc-yank-mouse" which forwards the data obtained by
> 'gui-selection-value' to 'calc-yank'.
>
> I'm not sure that 'gui-selection-value' is the correct function: What I
> mean is 'a function which respects 'select-enable-primary' and
> 'select-enable-clipboard' and returns the right thing from the
> corresponding X buffer'.
>
> To reproduce:
>
> 1) emacs -Q
> 2) M-x calc
> 3) Select a number in some other X window (xterm for example) with the
>    mouse
> 4) Go back to emacs *calc* buffer and press mouse-2.
>
>
>
> In GNU Emacs 25.0.94.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.6)
>  of 2016-05-25 built on beischer-w520
> Repository revision: 897fb6fa49d5ffc85f0a796e7414a43ef05ad096
> Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
> Configured using:
>  'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
>  --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
>  --with-sound=alsa --with-xft --with-modules --with-x-toolkit=gtk3
>  --without-gconf --with-gsettings 'CFLAGS=-march=native -O2 -pipe
>  -fstack-protector-strong' CPPFLAGS=-D_FORTIFY_SOURCE=2
>  LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
>
> Configured features:
> XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
> ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
> GTK3 X11 MODULES
>
> Important settings:
>   value of $LANG: en_US.UTF-8
>   locale-coding-system: utf-8-unix
>
> Major mode: Lisp Interaction
>
> Minor modes in effect:
>   projectile-global-mode: t
>   projectile-mode: t
>   yas-global-mode: t
>   yas-minor-mode: t
>   window-numbering-mode: t
>   company-mode: t
>   diff-auto-refine-mode: t
>   magit-auto-revert-mode: t
>   global-git-commit-mode: t
>   async-bytecomp-package-mode: t
>   flx-ido-mode: t
>   ido-everywhere: t
>   global-srecode-minor-mode: t
>   global-semanticdb-minor-mode: t
>   global-semantic-idle-scheduler-mode: t
>   global-semantic-decoration-mode: t
>   global-semantic-highlight-func-mode: t
>   global-semantic-stickyfunc-mode: t
>   global-semantic-show-parser-state-mode: t
>   semantic-mode: t
>   global-ede-mode: t
>   shell-dirtrack-mode: t
>   show-paren-mode: t
>   global-hi-lock-mode: t
>   hi-lock-mode: t
>   tooltip-mode: t
>   global-eldoc-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   column-number-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>   hs-minor-mode: t
>
> Recent messages:
> .emacs.d/cedet/lisp/cedet/ede/loaddefs.el: Obsolete name arg "lein2" to constructor ede-project-autoload
> .emacs.d/cedet/lisp/cedet/ede/loaddefs.el: Obsolete name arg "linux" to constructor ede-project-autoload
> .emacs.d/cedet/lisp/cedet/ede/loaddefs.el: Obsolete name arg "maven2" to constructor ede-project-autoload
> Parsing  *srecode-map-tmp* (LALR)...done
> Loading /home/beischer/.emacs.d/cedet/cedet-devel-load.el (source)...done
> ad-handle-definition: ‘ido-completing-read’ got redefined
> Loading buff-menu...done
> ad-handle-definition: ‘add-log-current-defun’ got redefined
> Turning on magit-auto-revert-mode...done
> For information about GNU Emacs and the GNU system, type C-h C-a.
>
> Load-path shadows:
> /home/beischer/.emacs.d/cedet/lisp/speedbar/loaddefs hides /home/beischer/.emacs.d/cedet/lisp/cedet/loaddefs
> /home/beischer/.emacs.d/elpa/helm-20160526.248/helm-multi-match hides /home/beischer/.emacs.d/elpa/helm-core-20160526.349/helm-multi-match
> /home/beischer/.emacs.d/elpa/cmake-mode-20160510.1140/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
> /usr/share/emacs/site-lisp/various/buff-menu hides /usr/share/emacs/25.0.94/lisp/buff-menu
> /home/beischer/.emacs.d/cedet/lisp/speedbar/loaddefs hides /usr/share/emacs/25.0.94/lisp/loaddefs
> /home/beischer/.emacs.d/elpa/emms-20160304.920/tq hides /usr/share/emacs/25.0.94/lisp/emacs-lisp/tq
>
> Features:
> (shadow sort mail-extr emacsbug sendmail company-oddmuse
> company-keywords company-etags company-gtags company-dabbrev-code
> company-dabbrev company-files company-capf company-cmake company-xcode
> company-clang company-semantic company-eclim company-template
> company-css company-nxml company-bbdb company-edbi edbi sql view jedi
> jedi-core python-environment epc ctable concurrent deferred
> auto-complete popup cmake-project gist gh-gist gh-oauth gh-api logito
> gh-cache pcache gh-auth gh-common gh-url url-http tls gnutls url-auth
> url-gw gh-profile json map timezone org-install tempo url url-proxy
> url-privacy url-expand url-methods url-history url-cookie url-domsuf
> url-util url-parse url-vars mailcap xml-parse doxymacs projectile
> ibuf-ext ibuffer dropdown-list yasnippet cl my-term term disp-table
> ehelp etags-table etags xref project cmake-mode thingatpt rx qt-pro
> pastebin window-numbering company magit-topgit magit-blame magit-stash
> magit-bisect magit-remote magit-commit epa magit-sequence magit esh-var
> esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg esh-groups eshell
> esh-module esh-mode esh-util magit-apply magit-wip magit-log magit-diff
> smerge-mode diff-mode magit-core magit-autorevert autorevert filenotify
> magit-process magit-popup magit-mode derived magit-git crm magit-section
> magit-utils git-commit log-edit message idna rfc822 mml mml-sec epg
> mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
> ietf-drums mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
> with-editor async-bytecomp easy-mmode async tramp-sh server hide-lines
> buff-menu+ hideshow flx-ido flx ido dired-x dired ede/cpp-root
> srecode/mode semantic/senator srecode/insert srecode/filters
> srecode/args semantic/db-mode f dash s semantic/bovine/c hideif
> semantic/bovine/c-by semantic/lex-spp semantic/idle working fame
> semantic/bovine/gcc semantic/dep semantic/bovine semantic/analyze/refs
> semantic/decorate/include semantic/db-find semantic/db-ref
> semantic/decorate/mode semantic/decorate pulse cedet-devel-load
> cogre/srecode cogre cogre/picture-hack rect picture eieio-opt find-func
> srecode/find srecode/map semantic/edit srecode/srt-mode srecode/template
> srecode/srt-wy semantic/wisent semantic/wisent/wisent srecode/ctxt
> srecode/compile srecode/dictionary srecode/table srecode
> semantic/canned-configs semantic/ia-sb semantic/analyze semantic/sort
> semantic/scope semantic/analyze/fcn semantic/db semantic/ctxt
> semantic/format semantic/tag-ls semantic/find semantic/util-modes
> semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
> sb-info ede/speedbar ede/files ede ede/detect ede/base ede/auto
> ede/source eieio-compat eieio-base eieio-speedbar speedbar sb-image
> ezimage dframe eieio-custom wid-edit cedet cedet-compat inversion
> cedet-remove-builtin cc-mode cc-fonts cc-guess cc-menus cc-cmds
> cc-styles cc-align cc-engine cc-vars cc-defs flymake finder-inf tex-site
> info package epg-config seq vc-cvs tramp tramp-compat auth-source cl-seq
> eieio byte-opt bytecomp byte-compile cl-extra cconv eieio-core cl-macs
> gv gnus-util mm-util help-fns help-mode easymenu mail-prsvr
> password-cache tramp-loaddefs trampver ucs-normalize shell pcomplete
> format-spec advice edmacro kmacro cl-loaddefs pcase cl-lib emacs-x-theme
> paren grep compile comint ansi-color ring linum hi-lock cus-start
> cus-load time-date mule-util tooltip eldoc electric uniquify ediff-hook
> vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd
> fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
> lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
> scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame
> cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
> tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
> slovak czech european ethiopic indian cyrillic chinese charscript
> case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
> cl-preloaded nadvice loaddefs button faces cus-face macroexp files
> text-properties overlay sha1 md5 base64 format env code-pages mule
> custom widget hashtable-print-readable backquote dbusbind inotify
> dynamic-setting system-font-setting font-render-setting move-toolbar gtk
> x-toolkit x multi-tty make-network-process emacs)
>
> Memory information:
> ((conses 16 614175 16718)
>  (symbols 48 51346 53)
>  (miscs 40 87 180)
>  (strings 32 120506 20978)
>  (string-bytes 1 3736110)
>  (vectors 16 72174)
>  (vector-slots 8 1281781 10649)
>  (floats 8 1544 163)
>  (intervals 56 402 0)
>  (buffers 976 14)
>  (heap 1024 50297 2436))



-- 
Bastian Beischer
RWTH Aachen University of Technology

@RWTH Aachen
Office: 28 C 203
Phone: +49-241-80-27205
E-mail: beischer <at> physik.rwth-aachen.de
Address: I. Physikalisches Institut B, Sommerfeldstr. 14, D-52074 Aachen

@CERN
Office: Bdg 32-4-B12
Phone: +41-22-76-75750
E-mail: bastian.beischer <at> cern.ch
Address: CERN, CH-1211 Geneve 23




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23629; Package emacs. (Wed, 11 Jan 2017 10:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 23629 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>
Cc: 23629 <at> debbugs.gnu.org, tino.calancha <at> gmail.com
Subject: Re: bug#23629: 25.0.94;
 Calc: Yanking with mouse-2 does not use X primary selection/clipboard
Date: Wed, 11 Jan 2017 19:26:21 +0900
Bastian Beischer <bastian.beischer <at> rwth-aachen.de> writes:

> I have customized 'select-enable-primary' to 't' and I'm using it to
> paste the X primary selection with 'mouse-2' often. This invokes
> mouse-yank-primary and that works fine.
>
> It does not work well in calc, though. In calc mouse-2 is bound to
> calc-yank, which takes the thing to be yanked from the kill-ring.
> To reproduce:
>
> 1) emacs -Q
> 2) M-x calc
> 3) Select a number in some other X window (xterm for example) with the
>    mouse
> 4) Go back to emacs *calc* buffer and press mouse-2.
Hi Bastian,

In addition to customize select-enable-primary to t, as you do,
i also like to set select-enable-clipboard to nil.  Then, the kill-ring
uses the primary selection, i.e., `calc-yank' pastes the same text
as `mouse-yank-primary' or `yank'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23629; Package emacs. (Wed, 11 Jan 2017 13:07:01 GMT) Full text and rfc822 format available.

Message #14 received at 23629 <at> debbugs.gnu.org (full text, mbox):

From: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 23629 <at> debbugs.gnu.org
Subject: Re: bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X
 primary selection/clipboard
Date: Wed, 11 Jan 2017 14:06:39 +0100
Hey Tino,

On Wed, Jan 11, 2017 at 11:26 AM, Tino Calancha <tino.calancha <at> gmail.com> wrote:
>
> Bastian Beischer <bastian.beischer <at> rwth-aachen.de> writes:
>
> > I have customized 'select-enable-primary' to 't' and I'm using it to
> > paste the X primary selection with 'mouse-2' often. This invokes
> > mouse-yank-primary and that works fine.
> >
> > It does not work well in calc, though. In calc mouse-2 is bound to
> > calc-yank, which takes the thing to be yanked from the kill-ring.
> > To reproduce:
> >
> > 1) emacs -Q
> > 2) M-x calc
> > 3) Select a number in some other X window (xterm for example) with the
> >    mouse
> > 4) Go back to emacs *calc* buffer and press mouse-2.
> Hi Bastian,
>
> In addition to customize select-enable-primary to t, as you do,
> i also like to set select-enable-clipboard to nil.  Then, the kill-ring
> uses the primary selection, i.e., `calc-yank' pastes the same text
> as `mouse-yank-primary' or `yank'.

I didn't check whether this works as you describe in calc, but I don't
want to set "select-enable-clipboard" to "nil". I'm using it to move
things in and out of the clipboard in other buffers.

Thanks for your comment, though :-)

Cheers
Bastian




Added tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 09 Oct 2019 15:52:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23629; Package emacs. (Tue, 11 Aug 2020 15:08:02 GMT) Full text and rfc822 format available.

Message #19 received at 23629 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>
Cc: eliz <at> gnu.org, 23629 <at> debbugs.gnu.org
Subject: Re: 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
Bastian Beischer <bastian.beischer <at> 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




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 11 Aug 2020 15:09:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23629; Package emacs. (Tue, 11 Aug 2020 15:56:01 GMT) Full text and rfc822 format available.

Message #24 received at 23629 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: bastian.beischer <at> rwth-aachen.de, 23629 <at> debbugs.gnu.org
Subject: Re: bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X
 primary selection/clipboard
Date: Tue, 11 Aug 2020 18:55:22 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: 23629 <at> debbugs.gnu.org, eliz <at> gnu.org
> Date: Tue, 11 Aug 2020 17:07:44 +0200
> 
> 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?

Yes, I think we can accept this without legal paperwork.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23629; Package emacs. (Tue, 11 Aug 2020 16:46:01 GMT) Full text and rfc822 format available.

Message #27 received at 23629 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: bastian.beischer <at> rwth-aachen.de, 23629 <at> debbugs.gnu.org
Subject: Re: bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X
 primary selection/clipboard
Date: Tue, 11 Aug 2020 18:45:22 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> Yes, I think we can accept this without legal paperwork.

OK; applied to Emacs 28.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 11 Aug 2020 16:46:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 23629 <at> debbugs.gnu.org and Bastian Beischer <bastian.beischer <at> rwth-aachen.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 11 Aug 2020 16:46:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23629; Package emacs. (Wed, 12 Aug 2020 16:06:02 GMT) Full text and rfc822 format available.

Message #34 received at 23629 <at> debbugs.gnu.org (full text, mbox):

From: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 23629 <at> debbugs.gnu.org
Subject: Re: bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X
 primary selection/clipboard
Date: Wed, 12 Aug 2020 18:04:37 +0200
Hello Lars,

thanks for applying the patch.

Cheers
Bastian


On Tue, Aug 11, 2020 at 6:45 PM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > Yes, I think we can accept this without legal paperwork.
>
> OK; applied to Emacs 28.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 10 Sep 2020 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 277 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.