From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.bugs Subject: bug#32470: rcirc-debug: ignore read-only; do not move point if mid-buffer; use %F Date: Sat, 18 Aug 2018 08:57:43 +0000 Message-ID: <87k1ooyrug.fsf@violet.siamics.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1534582569 3010 195.159.176.226 (18 Aug 2018 08:56:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 18 Aug 2018 08:56:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) To: 32470@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 18 10:56:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqx1g-0000gP-7B for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Aug 2018 10:56:04 +0200 Original-Received: from localhost ([::1]:38112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqx3m-0000Rr-If for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Aug 2018 04:58:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqx3d-0000Rl-Pz for bug-gnu-emacs@gnu.org; Sat, 18 Aug 2018 04:58:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqx3a-0003pt-KI for bug-gnu-emacs@gnu.org; Sat, 18 Aug 2018 04:58:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48907) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fqx3a-0003nT-8N for bug-gnu-emacs@gnu.org; Sat, 18 Aug 2018 04:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fqx3Z-0007V1-VT for bug-gnu-emacs@gnu.org; Sat, 18 Aug 2018 04:58:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Aug 2018 08:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32470 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: submit@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.153458267128774 (code B ref -1); Sat, 18 Aug 2018 08:58:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Aug 2018 08:57:51 +0000 Original-Received: from localhost ([127.0.0.1]:53925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqx3O-0007U0-Ko for submit@debbugs.gnu.org; Sat, 18 Aug 2018 04:57:51 -0400 Original-Received: from fely.am-1.org ([78.47.74.50]:48632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqx3M-0007Ti-EH for submit@debbugs.gnu.org; Sat, 18 Aug 2018 04:57:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net ; s=a2013295; h=Content-Type:MIME-Version:Message-ID:Date:X-License:To: Subject:From:Sender:Content-Transfer-Encoding:In-Reply-To:References:Reply-To :Cc:Content-ID:Content-Description; bh=+DmfF1WVdBaIT4vkzAel9TZmmAs/jYu7mFFBXpjCyjk=; b=CserASkcwY5RHQ3Cz4imzapb5I W9BkLZ6jAJe6i+yTPWC+gnCw4qaCtTjPdt7dHEW1BOvLF2ONJAqkCeDwPeS6V+/DzOB4YiPTiizYc 8zZ/f/TeP/P0kzZj/WFhUTU6EhTEmmiy4DcFb9ZS/Qqn4mbQjIHdCHFMZpY7m2rXKsoI=; Original-Received: from violet.siamics.net ([2001:470:1f13:1eb::1:1d]) by fely.am-1.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1fqx3K-0007NN-4A for submit@debbugs.gnu.org; Sat, 18 Aug 2018 08:57:46 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtp (Exim 4.84_2) (envelope-from ) id 1fqx3I-00086a-4Z for submit@debbugs.gnu.org; Sat, 18 Aug 2018 08:57:44 +0000 X-License: CC0-1.0 (original contributions only) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:149567 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Package: emacs Severity: wishlist Tags: patch I find it quite convenient to be able to make the *rcirc debug* buffer read-only, so that I won=E2=80=99t be able to change it by accident. This of course requires the rcirc-debug function to use inhibit-read-only. Another usability tweak is to restore point after insertion =E2=80=93 unless it was at the end of the (visible portion of the) buffer before. (Hence allowing the buffer to scroll normally after end-of-buffer is used.) Also, while we=E2=80=99re at, %Y-%m-%d can be replaced with the equivalent %F in the format-time-string argument; and concat is useless as =E2=80=98insert=E2=80=99 effectively concatenates its string arguments already. I=E2=80=99m somewhat unsure if this change is NEWS-worthy; if so, I suggest the following entry. ** rcirc +++ *** The 'rcirc-debug-buffer' can now be made read-only; it will be ignored when adding debug text to it. Also, the point will not be moved, unless it's set to the end of the visible portion of the buffer. Please thus consider the patch MIMEd. --=20 FSF associate member #7257 np. Funicul=C3=AC, funicul=C3=A0 =E2=80=94 Luci= ano Pavarotti --=-=-= Content-Type: text/patch Content-Disposition: inline From: Ivan Shmakov Subject: Improve user convenience of the rcirc debug buffer Date: Sat, 18 Aug 2018 08:57:08 +0000 * lisp/net/rcirc.el (rcirc-debug): Ignore rcirc-debug-buffer read-only status. Restore point after insertion unless it was at the end. Replace %Y-%m-%d with the equivalent %F in format-time-string; remove useless concat. (Bug#-XXX-) --- --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -670,16 +670,24 @@ "If non-nil, write information to `rcirc-debug-buffer'.") (defun rcirc-debug (process text) "Add an entry to the debug log including PROCESS and TEXT. -Debug text is written to `rcirc-debug-buffer' if `rcirc-debug-flag' -is non-nil." +Debug text is appended to `rcirc-debug-buffer' if `rcirc-debug-flag' +is non-nil. + +For convenience, the read-only state of the debug buffer is ignored. +When the point is at the end of the visible portion of the buffer, it +is moved to after the text inserted. Otherwise the point is not moved." (when rcirc-debug-flag (with-current-buffer (get-buffer-create rcirc-debug-buffer) - (goto-char (point-max)) - (insert (concat - "[" - (format-time-string "%Y-%m-%dT%T ") (process-name process) - "] " - text))))) + (let ((old (set-marker (make-marker) (point)))) + (set-marker-insertion-type old t) + (goto-char (point-max)) + (let ((inhibit-read-only t)) + (terpri (current-buffer) t) + (insert "[" + (format-time-string "%FT%T ") (process-name process) + "] " + text)) + (goto-char old))))) (define-obsolete-variable-alias 'rcirc-sentinel-hooks 'rcirc-sentinel-functions "24.3") --=-=-=--