X-Loop: help-debbugs@HIDDEN Subject: bug#29286: kill-visible/kill-ring-save-visible commands Resent-From: charles@HIDDEN (Charles A. Roelli) Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Mon, 13 Nov 2017 19:29:01 +0000 Resent-Message-ID: <handler.29286.B.151060131421872 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 29286 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 29286 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.151060131421872 (code B ref -1); Mon, 13 Nov 2017 19:29:01 +0000 Received: (at submit) by debbugs.gnu.org; 13 Nov 2017 19:28:34 +0000 Received: from localhost ([127.0.0.1]:38878 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1eEKPJ-0005gi-OO for submit <at> debbugs.gnu.org; Mon, 13 Nov 2017 14:28:33 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <charles@HIDDEN>) id 1eEKPI-0005gR-2g for submit <at> debbugs.gnu.org; Mon, 13 Nov 2017 14:28:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <charles@HIDDEN>) id 1eEKPB-00016I-RA for submit <at> debbugs.gnu.org; Mon, 13 Nov 2017 14:28:26 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:33185) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <charles@HIDDEN>) id 1eEKPB-000164-NC for submit <at> debbugs.gnu.org; Mon, 13 Nov 2017 14:28:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <charles@HIDDEN>) id 1eEKPA-0006q5-Kc for bug-gnu-emacs@HIDDEN; Mon, 13 Nov 2017 14:28:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <charles@HIDDEN>) id 1eEKP7-00013m-GD for bug-gnu-emacs@HIDDEN; Mon, 13 Nov 2017 14:28:24 -0500 Received: from [2a03:2040:2:1b::1] (port=59444 helo=sinyavsky.aurox.ch) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <charles@HIDDEN>) id 1eEKP7-00011D-7d for bug-gnu-emacs@HIDDEN; Mon, 13 Nov 2017 14:28:21 -0500 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 6BC63225BA for <bug-gnu-emacs@HIDDEN>; Mon, 13 Nov 2017 19:21:02 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= subject:subject:to:from:from:message-id:date:date; s=dkim; t= 1510600860; x=1511464861; bh=6b4RFqY3L68P2jl3ic4HrPUBk2ekILE93hw nUHmf9B0=; b=YMd8qYDHiPwswXHwKuNO/Qna9hhp8hX9ITwjYoKHAfZqZjyCDt4 oO9uLCNLV9pPvfHJukmN4TvcgUO3+CqeYbQfOS7dw78e90A2+5HIhKw6bqcsRhST YxRYpgH7SZ5KYSyH5jqcoO3Pq2C2jHb7l4FPzr+9cv/FzsrxipbS4BuE= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id IQONR95SYu5Z for <bug-gnu-emacs@HIDDEN>; Mon, 13 Nov 2017 19:21:00 +0000 (UTC) Received: from gray (125.85.192.178.dynamic.wline.res.cust.swisscom.ch [178.192.85.125]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 726A422570 for <bug-gnu-emacs@HIDDEN>; Mon, 13 Nov 2017 19:21:00 +0000 (UTC) Date: Mon, 13 Nov 2017 20:28:18 +0100 Message-Id: <m2o9o6vuzx.fsf@HIDDEN> From: charles@HIDDEN (Charles A. Roelli) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -4.1 (----) It can be convenient sometimes to kill text exactly as it is displayed. For example, if you have some text in a program hidden with "hs-minor-mode", then want to copy part of the buffer including the hidden text, the hidden text will still be part of the killed text. Or if you kill text in an Info node, you sometimes find that you've also yanked some invisible text with it. I wrote the following commands to test omission of invisible text: (defun kill-visible-region (beg end &optional delete) (interactive (list (mark) (point) t)) (let ((filter-buffer-substring-function 'visible-buffer-substring)) (kill-ring-save beg end region))) (defun kill-ring-save-visible-region (beg end &optional delete) (interactive (list (mark) (point) nil)) (let ((filter-buffer-substring-function 'visible-buffer-substring)) (kill-ring-save beg end delete))) (defun visible-buffer-substring (beg end delete) "Return visible text in BEG to END in the current buffer. Delete if DELETE is non-nil." (let ((text "") (ellipse-p nil)) (save-excursion (goto-char beg) (while (< (point) end) (let ((invis (invisible-p (point)))) (cond ((eq invis nil) (setq text (concat text (make-string 1 (char-after (point)))) ellipse-p nil)) ((eq invis t) (setq ellipse-p nil)) ((and invis (not ellipse-p)) (setq text (concat text (make-string 3 ?.)) ellipse-p t))) (goto-char (1+ (point)))))) (if delete (delete-region beg end)) text)) They work for the purpose of killing text partially hidden by hs-minor-mode, but the solution is not general, since there are many ways to make text in Emacs display something other than its characters. I had also written another command using `text-char-description' to kill text in a lossy way, so that literal characters like ^@ would be killed as the two characters "^@". It would also make sense to make that part of `kill-visible-region', if it's possible.
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: charles@HIDDEN (Charles A. Roelli) Subject: bug#29286: Acknowledgement (kill-visible/kill-ring-save-visible commands) Message-ID: <handler.29286.B.151060131421872.ack <at> debbugs.gnu.org> References: <m2o9o6vuzx.fsf@HIDDEN> X-Gnu-PR-Message: ack 29286 X-Gnu-PR-Package: emacs Reply-To: 29286 <at> debbugs.gnu.org Date: Mon, 13 Nov 2017 19:29:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 29286 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 29286: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D29286 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
Received: (at control) by debbugs.gnu.org; 13 Nov 2017 22:17:18 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 13 17:17:18 2017 Received: from localhost ([127.0.0.1]:38997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1eEN2c-0001CV-IW for submit <at> debbugs.gnu.org; Mon, 13 Nov 2017 17:17:18 -0500 Received: from mail-wr0-f181.google.com ([209.85.128.181]:47931) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <npostavs@HIDDEN>) id 1eEN2a-0001CI-J1 for control <at> debbugs.gnu.org; Mon, 13 Nov 2017 17:17:17 -0500 Received: by mail-wr0-f181.google.com with SMTP id k61so15787449wrc.4 for <control <at> debbugs.gnu.org>; Mon, 13 Nov 2017 14:17:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=XyK1VNHC7zJlj+hhMdhOC0r8+hnVpu31KCfeQUbn5Nk=; b=T+v7k8YqX2LzFNK/++oQNrRR6hVvmPv3xkxBGEz90UPMgYTQpNKpdAhiHTu4j50Yr6 Gf3IiWnx1PN05pE7Pb7QKgm6BXCFCKya4Uaf4VgMgrXXF2bo0wWOppp8gSZNIKYUC+gB wXsMOCksBJTxwtPrigLEZtpqyQw/pVtJKp2AsEopZpwAReenQoXnSbj97fMsmzfLl/FL cTg/n1oy20OfazXJyfchyEUQPeeLU2sB055b5LZu1RtPF/ktghpPLFOXtaeuzfp2vn1W FVySufwULxLxs+6y+1VBoBVBDCgkfRTh4qUOPjhKiGwFexnGBBPFbjGXLz/PUJR4Bj3s zpHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=XyK1VNHC7zJlj+hhMdhOC0r8+hnVpu31KCfeQUbn5Nk=; b=rpNjo1vQQ8+NwCAzPntyY5sBTc7a1c53yEmLPG1HgTTlI1IzVZk10Hi6PhfLOIbCsq DV71frIa5DBsDggDUc/ZFxTXn8PYx7dAeS1y1j6X9T809ah593UE7bvW0gZ+IjSt9+Vf OOVmWaghYSUfotxwP3oQKXcUgig3A/JJvcoll3M0/x6W96Wk8ESU49cp6TyaBxCOsshK 56Np4008Ot6Kmw1zW822RXW/FQB4UM4nofNd604TAFofESKBCgoM+2GVOmaXRkFFlgvP f98da+1I5UBl7IPDTAkRbOfQk5zDKxWoo1S8RXlz+RgRdQChVnpgxxPEH8I+aqd9/h2q pTFA== X-Gm-Message-State: AJaThX42xIYoDwjO3QQ8gyCMBB1deSTVbs41qwhkBrjwpL1Fa7Jnyp8t 5nTYiLS7iDA+bJlJMRNEM8/PiWL4W4aKLu2j08UA7g== X-Google-Smtp-Source: AGs4zMYOBVfdUff5TWMptn3DeOU01BCJlRVLPuhL763FDdjiaEax1hLUH1phj6AZhJLyPD7P+hjF8dxtGCZRQdOQlXE= X-Received: by 10.223.184.171 with SMTP id i40mr9202364wrf.124.1510611430671; Mon, 13 Nov 2017 14:17:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.151.116 with HTTP; Mon, 13 Nov 2017 14:17:10 -0800 (PST) From: Noam Postavsky <npostavs@HIDDEN> Date: Mon, 13 Nov 2017 17:17:10 -0500 X-Google-Sender-Auth: cz7b5mKx-FCC4RkGPAmtzaL62EI Message-ID: <CAM-tV--EwuPi0zL5R_U0BsW9Tz7uc9dkO344ezfQPSX=W9e4Yw@HIDDEN> Subject: bug#29286: kill-visible/kill-ring-save-visible commands To: GNU bug tracker automated control server <control <at> debbugs.gnu.org> Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.6 (--) severity 29286 wishlist merge 29286 19471 quit
Received: (at control) by debbugs.gnu.org; 13 Nov 2017 22:17:18 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 13 17:17:18 2017 Received: from localhost ([127.0.0.1]:38997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1eEN2c-0001CV-IW for submit <at> debbugs.gnu.org; Mon, 13 Nov 2017 17:17:18 -0500 Received: from mail-wr0-f181.google.com ([209.85.128.181]:47931) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <npostavs@HIDDEN>) id 1eEN2a-0001CI-J1 for control <at> debbugs.gnu.org; Mon, 13 Nov 2017 17:17:17 -0500 Received: by mail-wr0-f181.google.com with SMTP id k61so15787449wrc.4 for <control <at> debbugs.gnu.org>; Mon, 13 Nov 2017 14:17:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=XyK1VNHC7zJlj+hhMdhOC0r8+hnVpu31KCfeQUbn5Nk=; b=T+v7k8YqX2LzFNK/++oQNrRR6hVvmPv3xkxBGEz90UPMgYTQpNKpdAhiHTu4j50Yr6 Gf3IiWnx1PN05pE7Pb7QKgm6BXCFCKya4Uaf4VgMgrXXF2bo0wWOppp8gSZNIKYUC+gB wXsMOCksBJTxwtPrigLEZtpqyQw/pVtJKp2AsEopZpwAReenQoXnSbj97fMsmzfLl/FL cTg/n1oy20OfazXJyfchyEUQPeeLU2sB055b5LZu1RtPF/ktghpPLFOXtaeuzfp2vn1W FVySufwULxLxs+6y+1VBoBVBDCgkfRTh4qUOPjhKiGwFexnGBBPFbjGXLz/PUJR4Bj3s zpHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=XyK1VNHC7zJlj+hhMdhOC0r8+hnVpu31KCfeQUbn5Nk=; b=rpNjo1vQQ8+NwCAzPntyY5sBTc7a1c53yEmLPG1HgTTlI1IzVZk10Hi6PhfLOIbCsq DV71frIa5DBsDggDUc/ZFxTXn8PYx7dAeS1y1j6X9T809ah593UE7bvW0gZ+IjSt9+Vf OOVmWaghYSUfotxwP3oQKXcUgig3A/JJvcoll3M0/x6W96Wk8ESU49cp6TyaBxCOsshK 56Np4008Ot6Kmw1zW822RXW/FQB4UM4nofNd604TAFofESKBCgoM+2GVOmaXRkFFlgvP f98da+1I5UBl7IPDTAkRbOfQk5zDKxWoo1S8RXlz+RgRdQChVnpgxxPEH8I+aqd9/h2q pTFA== X-Gm-Message-State: AJaThX42xIYoDwjO3QQ8gyCMBB1deSTVbs41qwhkBrjwpL1Fa7Jnyp8t 5nTYiLS7iDA+bJlJMRNEM8/PiWL4W4aKLu2j08UA7g== X-Google-Smtp-Source: AGs4zMYOBVfdUff5TWMptn3DeOU01BCJlRVLPuhL763FDdjiaEax1hLUH1phj6AZhJLyPD7P+hjF8dxtGCZRQdOQlXE= X-Received: by 10.223.184.171 with SMTP id i40mr9202364wrf.124.1510611430671; Mon, 13 Nov 2017 14:17:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.151.116 with HTTP; Mon, 13 Nov 2017 14:17:10 -0800 (PST) From: Noam Postavsky <npostavs@HIDDEN> Date: Mon, 13 Nov 2017 17:17:10 -0500 X-Google-Sender-Auth: cz7b5mKx-FCC4RkGPAmtzaL62EI Message-ID: <CAM-tV--EwuPi0zL5R_U0BsW9Tz7uc9dkO344ezfQPSX=W9e4Yw@HIDDEN> Subject: bug#29286: kill-visible/kill-ring-save-visible commands To: GNU bug tracker automated control server <control <at> debbugs.gnu.org> Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.6 (--) severity 29286 wishlist merge 29286 19471 quit
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.