From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Bruno Barbier Newsgroups: gmane.emacs.help Subject: Re: How to clipboard copy emacs help text by user-made interactive function kill-ring-save Date: Fri, 10 May 2019 01:34:53 +0200 Message-ID: <5cd4ab4c.1c69fb81.f0016.cf54@mx.google.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="206123"; mail-complaints-to="usenet@blaine.gmane.org" To: Budi , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 10 00:45:30 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOrn5-000rRD-MY for geh-help-gnu-emacs@m.gmane.org; Fri, 10 May 2019 00:45:27 +0200 Original-Received: from localhost ([127.0.0.1]:33727 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOrn4-0006u2-Ee for geh-help-gnu-emacs@m.gmane.org; Thu, 09 May 2019 18:45:26 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOre0-0008IR-VC for help-gnu-emacs@gnu.org; Thu, 09 May 2019 18:36:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOrdz-0002ZB-16 for help-gnu-emacs@gnu.org; Thu, 09 May 2019 18:36:04 -0400 Original-Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:33501) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOrdv-0002YU-OX for help-gnu-emacs@gnu.org; Thu, 09 May 2019 18:36:01 -0400 Original-Received: by mail-wr1-x436.google.com with SMTP id e11so5179676wrs.0 for ; Thu, 09 May 2019 15:35:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:from:to:subject:in-reply-to:references:date:mime-version; bh=Xw7WrZpzpsTT6e4KFP9mAeK1f6Hmc3fY1kd3+HrtdZI=; b=VRI+lf6m6MZ1a4bRTCJwE73EZ2Nm0a/Y6IL6vFHUn7r8A2+7WVK4AHNb6/lv5QHd9D 3gRn+dfKhniXKjOCAszwoZt9Ok6mAcRCXKnPIjXjJUvMidwj9mKJASaNdA/1N09vCMV4 IuesEkm8pU+C5llzLsZ5lcHFkLk/SPpBSzaKCVok14Wv3oiOSpOpGHGcTkTkoxeTplNv 0H6am6eRdsa3m0iXBEq/ghYYE6JMB1G/1MftALRoV4O99S3xYfX+9jAcYOUs0U1rZ1yD 0qHuZxgmDgIHdfq9o5+1EJaSh0/8o3KB7X/61U2wd7KHVklxUVM7pZj2b2BvJwyS2d6Q c7gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:from:to:subject:in-reply-to :references:date:mime-version; bh=Xw7WrZpzpsTT6e4KFP9mAeK1f6Hmc3fY1kd3+HrtdZI=; b=nGVLP/KfVbsG5GHJi7vIXya/r37QPwvgELf/EgH+iWYnhJMhlk6GcJ9Lnn7OFkylqK rdnx/eC9Tn/nA2jyAwfNfEJOH9kOx5ujjS8TPkRQ5FkeZ/N6QU8fNhnoM2G21ujSkUpN bzgShh8cYSP7qR0BeBx5Xef28TnTDRzj7CV6X/lyJWbKdX9j4L41fsYk7yX8MvaNPV1w mqslUMsko6nkUtRvfvgjwPL6/Psfpxpghq1u+mlMxwZiY2mPVReSAvsBM8KUq91PKehU QS3NxYYAr3yrIl/t7cJ9Zo2RdZhf0eUXU+UsVNmpr2INuu7A3YV1OWlY+dOjokdVJVy7 UckQ== X-Gm-Message-State: APjAAAVkkf0pmAMN+Q71fpL9WeXuM4mYJaHWXhErONwrD5W+R+2+Nzg2 rIUXbSmrdG8N31fXAdWrHFY= X-Google-Smtp-Source: APXvYqxbaLnOIH6OweBzyPfDXM0pik2U5v/aGAaKuPX/FbL2O3JyyOq3dQahpLOxaAg6JIl7E12QAQ== X-Received: by 2002:a5d:52ce:: with SMTP id r14mr5221210wrv.224.1557441357813; Thu, 09 May 2019 15:35:57 -0700 (PDT) Original-Received: from tosh-laptop ([2a01:e0a:77:5500:198:efdf:4d36:80dc]) by smtp.gmail.com with ESMTPSA id f138sm5688319wmf.23.2019.05.09.15.35.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 May 2019 15:35:56 -0700 (PDT) Original-Received: by tosh-laptop (sSMTP sendmail emulation); Fri, 10 May 2019 01:34:53 +0200 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::436 X-Mailman-Approved-At: Thu, 09 May 2019 18:36:56 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:120275 Archived-At: Hi, Budi 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 ?