emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Toggling select-enable-clipboard & select-enable-primary prevents org-copy-visible to work
@ 2022-08-10  7:53 Alain.Cochard
  2022-08-10  9:59 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Alain.Cochard @ 2022-08-10  7:53 UTC (permalink / raw)
  To: Org Mode List; +Cc: Alain Cochard


Hello.

When my .emacs contains only the following:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(select-enable-clipboard nil)
 '(select-enable-primary t)
 )	

then org-copy-visible does not work properly: when yanking, whether it
be with 'yank' or 'org-yank', the invisible parts are also yanked.

Is it normal?  After all, the emacs manual says:

      Prior to Emacs 24, the kill and yank commands used the primary
  selection (*note Primary Selection::), not the clipboard.  If you
  prefer this behavior, change ‘select-enable-clipboard’ to ‘nil’,
  ‘select-enable-primary’ to ‘t’, and ‘mouse-drag-copy-region’ to ‘t’.

Regards.


GNU Emacs 27.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version
3.24.30, cairo version 1.17.4) of 2021-08-07

Org mode version 9.5.4 (9.5.4-ge0b05b @ /home/cochard/.emacs.d/elpa/org-9.5.4/)



-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 106]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | [ slot available for rent ]



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Toggling select-enable-clipboard & select-enable-primary prevents org-copy-visible to work
  2022-08-10  7:53 Toggling select-enable-clipboard & select-enable-primary prevents org-copy-visible to work Alain.Cochard
@ 2022-08-10  9:59 ` Ihor Radchenko
  2022-08-13 14:46   ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2022-08-10  9:59 UTC (permalink / raw)
  To: alain.cochard; +Cc: Org Mode List

Alain.Cochard@unistra.fr writes:

> When my .emacs contains only the following:
>
> (custom-set-variables
>  ;; custom-set-variables was added by Custom.
>  ;; If you edit it by hand, you could mess it up, so be careful.
>  ;; Your init file should contain only one such instance.
>  ;; If there is more than one, they won't work right.
>  '(select-enable-clipboard nil)
>  '(select-enable-primary t)
>  )	
>
> then org-copy-visible does not work properly: when yanking, whether it
> be with 'yank' or 'org-yank', the invisible parts are also yanked.
>
> Is it normal?  After all, the emacs manual says:

This is not normal, and I can reproduce the issue.
However, it does not look like Org is doing anything wrong. We call
kill-new with the correct value containing only visible part of the
buffer.

I suggest you to file a bug report to Emacs itself using M-x report-emacs-bug
In the report, you can cite this email.

Below, I am also detailing steps to reproduce to help Emacs devs debug
the problem:

1. Create bug.el with the following contents:
----
(custom-set-variables
 '(select-enable-clipboard nil)
 '(select-enable-primary t))
(defun my/copy-const (beg end)
  (interactive "r")
  (setq deactivate-mark t)
  (kill-new "Constant string"))
----
2. Create bug.org with the following contents:
----
* headline
Hidden text inside
* another headline
----
3. emacs -Q -l /path/to/bug.el /path/to/bug.org
4. S-<TAB>
5. M-x my/copy-const
6. C-y

Expected: "Constant string" is inserted
Observed: Selected region is inserted.


-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Toggling select-enable-clipboard & select-enable-primary prevents org-copy-visible to work
  2022-08-10  9:59 ` Ihor Radchenko
@ 2022-08-13 14:46   ` Ihor Radchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2022-08-13 14:46 UTC (permalink / raw)
  To: alain.cochard; +Cc: Org Mode List

Ihor Radchenko <yantar92@gmail.com> writes:

> This is not normal, and I can reproduce the issue.
> However, it does not look like Org is doing anything wrong. We call
> kill-new with the correct value containing only visible part of the
> buffer.
>
> I suggest you to file a bug report to Emacs itself using M-x report-emacs-bug
> In the report, you can cite this email.

After the relevant fix on Emacs side, we can solve the issue on Org side
as long as Emacs 29 is being used.

Fixed on main via edf46425b.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=edf46425bb0f78ca5f571de2761e94ad7caf7aab


-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-13 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-10  7:53 Toggling select-enable-clipboard & select-enable-primary prevents org-copy-visible to work Alain.Cochard
2022-08-10  9:59 ` Ihor Radchenko
2022-08-13 14:46   ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).