all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to clipboard copy emacs help text by user-made interactive function kill-ring-save
@ 2019-05-09  4:22 Budi
  2019-05-09  5:36 ` Emanuel Berg
  2019-05-09 23:34 ` Bruno Barbier
  0 siblings, 2 replies; 3+ messages in thread
From: Budi @ 2019-05-09  4:22 UTC (permalink / raw)
  To: help-gnu-emacs

I tried to clipboard copy some emacs read-only text by user-made
interactive function kill-ring-save, but fail
It's not M-w bound to kill-ring-save emacs built in function which is working

but as my preceding question, the copy :

(defun copy (b e)
  (interactive "r")
  (if (use-region-p) (call-interactively 'kill-ring-save)
  (save-excursion
  (beginning-of-line)
  (set-mark (line-end-position))
  (kill-ring-save (point)(mark))
  ))))
(global-set-key (kbd "C-c") 'copy)

cannot copy such case above,
any idea what's actually made different behavior of kill-ring-save ?



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

* Re: How to clipboard copy emacs help text by user-made interactive function kill-ring-save
  2019-05-09  4:22 How to clipboard copy emacs help text by user-made interactive function kill-ring-save Budi
@ 2019-05-09  5:36 ` Emanuel Berg
  2019-05-09 23:34 ` Bruno Barbier
  1 sibling, 0 replies; 3+ messages in thread
From: Emanuel Berg @ 2019-05-09  5:36 UTC (permalink / raw)
  To: help-gnu-emacs

Budi wrote:

> I tried to clipboard copy some emacs
> read-only text by user-made interactive
> function kill-ring-save, but fail It's not
> M-w bound to kill-ring-save emacs built in
> function which is working

I'll be happy to (try) to help you, but please
try to formulate the problem in terms of what
it is you want to happen, not in terms how how
you tried to do it already. It gets confused
that way :)

You want to `kill-ring-save' the text in the
region? If so, just set it (the region) and hit
M-w :)

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: How to clipboard copy emacs help text by user-made interactive function kill-ring-save
  2019-05-09  4:22 How to clipboard copy emacs help text by user-made interactive function kill-ring-save Budi
  2019-05-09  5:36 ` Emanuel Berg
@ 2019-05-09 23:34 ` Bruno Barbier
  1 sibling, 0 replies; 3+ messages in thread
From: Bruno Barbier @ 2019-05-09 23:34 UTC (permalink / raw)
  To: Budi, help-gnu-emacs


Hi,

Budi <budikusasi@gmail.com> writes:

> I tried to clipboard copy some emacs read-only text by user-made
> interactive function kill-ring-save, but fail
> It's not M-w bound to kill-ring-save emacs built in function which is working
>
> but as my preceding question, the copy :
>
> (defun copy (b e)
>   (interactive "r")
>   (if (use-region-p) (call-interactively 'kill-ring-save)
>   (save-excursion
>   (beginning-of-line)
>   (set-mark (line-end-position))
>   (kill-ring-save (point)(mark))
>   ))))

(When you define your own function, you should use your own prefix
to avoid replacing Emacs own functions.

    copy => my-copy, budi-copy, etc.
)

Assuming you're getting the following error:

   The mark is not set now, so there is no region

Your line:

   (interactive "r")
   
tells Emacs to provide a region "r" (point=>b and mark=>e) when called
interactively; it fails when there is no mark.

Remove the arguments 'b', 'e', don't request a region (drop the "r"),
and it should work.

If it doesn't, try to copy/paste the exact error and the exact steps to
reproduce.

It's probably better to use the same thread until your problem is
solved by the way, specially if you mentioned your previous emails.


Regards,

Bruno









> (global-set-key (kbd "C-c") 'copy)
>
> cannot copy such case above,
> any idea what's actually made different behavior of kill-ring-save ?



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

end of thread, other threads:[~2019-05-09 23:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-09  4:22 How to clipboard copy emacs help text by user-made interactive function kill-ring-save Budi
2019-05-09  5:36 ` Emanuel Berg
2019-05-09 23:34 ` Bruno Barbier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.