* bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X primary selection/clipboard
@ 2016-05-27 11:17 Bastian Beischer
2016-06-13 7:40 ` Bastian Beischer
2017-01-11 10:26 ` Tino Calancha
0 siblings, 2 replies; 8+ messages in thread
From: Bastian Beischer @ 2016-05-27 11:17 UTC (permalink / raw)
To: 23629
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))
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X primary selection/clipboard
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
2017-01-11 10:26 ` Tino Calancha
1 sibling, 1 reply; 8+ messages in thread
From: Bastian Beischer @ 2016-06-13 7:40 UTC (permalink / raw)
To: 23629
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@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@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@cern.ch
Address: CERN, CH-1211 Geneve 23
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X primary selection/clipboard
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
@ 2017-01-11 10:26 ` Tino Calancha
2017-01-11 13:06 ` Bastian Beischer
1 sibling, 1 reply; 8+ messages in thread
From: Tino Calancha @ 2017-01-11 10:26 UTC (permalink / raw)
To: Bastian Beischer; +Cc: 23629, tino.calancha
Bastian Beischer <bastian.beischer@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'.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X primary selection/clipboard
2017-01-11 10:26 ` Tino Calancha
@ 2017-01-11 13:06 ` Bastian Beischer
0 siblings, 0 replies; 8+ messages in thread
From: Bastian Beischer @ 2017-01-11 13:06 UTC (permalink / raw)
To: Tino Calancha; +Cc: 23629
Hey Tino,
On Wed, Jan 11, 2017 at 11:26 AM, Tino Calancha <tino.calancha@gmail.com> wrote:
>
> Bastian Beischer <bastian.beischer@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
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X primary selection/clipboard
2016-06-13 7:40 ` Bastian Beischer
@ 2020-08-11 15:07 ` Lars Ingebrigtsen
2020-08-11 15:55 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-11 15:07 UTC (permalink / raw)
To: Bastian Beischer; +Cc: 23629
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X primary selection/clipboard
2020-08-11 15:07 ` Lars Ingebrigtsen
@ 2020-08-11 15:55 ` Eli Zaretskii
2020-08-11 16:45 ` Lars Ingebrigtsen
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2020-08-11 15:55 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: bastian.beischer, 23629
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: 23629@debbugs.gnu.org, eliz@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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X primary selection/clipboard
2020-08-11 15:55 ` Eli Zaretskii
@ 2020-08-11 16:45 ` Lars Ingebrigtsen
2020-08-12 16:04 ` Bastian Beischer
0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-11 16:45 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: bastian.beischer, 23629
Eli Zaretskii <eliz@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
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#23629: 25.0.94; Calc: Yanking with mouse-2 does not use X primary selection/clipboard
2020-08-11 16:45 ` Lars Ingebrigtsen
@ 2020-08-12 16:04 ` Bastian Beischer
0 siblings, 0 replies; 8+ messages in thread
From: Bastian Beischer @ 2020-08-12 16:04 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 23629
Hello Lars,
thanks for applying the patch.
Cheers
Bastian
On Tue, Aug 11, 2020 at 6:45 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:
>
> Eli Zaretskii <eliz@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
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-08-12 16:04 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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).