bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#28631: 25.3.50; Deactivate mark with Ctrl-g mess up the primary-sele


From: Tino Calancha
Subject: bug#28631: 25.3.50; Deactivate mark with Ctrl-g mess up the primary-selection
Date: Thu, 28 Sep 2017 17:02:39 +0900

Tags: patch

I am biten by this problem from time to time.  When winer-mode
is enabled and i deactivate the mark with C-g, then i observe
funny behaviour with `yank'.

Usually i visit another buffer BUF-B to copy a string STR; then
i do `winner-undo' to comeback to the initial buffer, BUF-A,  and `yank'
STR.  Sometimes i found that `yank' insert a string different than STR.
That's happen if i previously deactivated the mark in BUF-A with C-g.

To reproduce the problem:
emacs  -Q -eval '(winner-mode 1)' \
-eval "(customize-set-variable 'select-enable-clipboard nil)" \
-eval "(customize-set-variable 'select-enable-primary t)"

< C-TAB M-f M-f ; `yank' would insert ";; This buffer"
C-x C-b C-x 0
C-x h ; mark whole buffer
;; `yank' would insert the content of *Buffer List*
C-g
RET ; `yank' would insert  ";; This buffer"
C-c <left> ; winner-undo
;; `yank' would insert the content of *Buffer List*

Note that the primary selection doesn't change if you visit
*Buffer List* with C-x b RET.  That is, if you change above
C-c <left>
by:
C-x b RET

then, the `yank' will insert ";;This buffer".

I don't see a good reason why visiting a buffer with `C-x b' or
`winner-undo' makes a difference in the primary selection.

How about the following patch?
--8<-----------------------------cut here---------------start------------->8---
commit 74e5a589b762388baadbb2ac2f146bbe66765deb
Author: Tino Calancha <address@hidden>
Date:   Thu Sep 28 16:34:52 2017 +0900

    Set mark at point after keyboard-quit
    
    * lisp/simple.el (deactivate-mark): In transient-mark-mode
    always set the mark at point after keyboard-quit (Bug#28631).

diff --git a/lisp/simple.el b/lisp/simple.el
index 469557713d..1f809d8964 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5349,6 +5349,11 @@ deactivate-mark
       (kill-local-variable 'transient-mark-mode)))
     (setq mark-active nil)
     (run-hooks 'deactivate-mark-hook)
+    ;; Set mark at point after `keyboard-quit' (Bug#28631).
+    (when (and transient-mark-mode
+               (eq this-command 'keyboard-quit)
+               (/= (mark 'force) (point)))
+      (push-mark nil 'nomsg))
     (redisplay--update-region-highlight (selected-window))))
 
 (defun activate-mark (&optional no-tmm)

--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 27.0.50 (build 11, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-28
Repository revision: 1f02ae39310f15bf683642b9aee1cf162bd391e6


In GNU Emacs 25.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-20 built on calancha-pc
Repository revision: c3ff6712ad24fcf45874dc0665a8606e9b2208a4
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description:     Debian GNU/Linux 9.1 (stretch)

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

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

Major mode: Buffer Menu

Minor modes in effect:
  winner-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-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
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set [4 times]
Quit
Winner undo (1 / 4)
Quit

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode mail-prsvr
mail-utils cus-edit easymenu cus-start cus-load wid-edit cl-loaddefs
pcase cl-lib winner ring 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 104842 3683)
 (symbols 48 21319 0)
 (miscs 40 108 146)
 (strings 32 17876 5250)
 (string-bytes 1 487777)
 (vectors 16 12687)
 (vector-slots 8 439460 5000)
 (floats 8 174 21)
 (intervals 56 281 10)
 (buffers 976 20))





reply via email to

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