From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#22453: [PATCH] Support for switching to hexl-mode from image mode Date: Sun, 24 Jan 2016 16:48:25 +0200 Message-ID: <83fuxn3ufa.fsf@gnu.org> References: <1453617036-17528-1-git-send-email-kuleshovmail@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1453646970 26242 80.91.229.3 (24 Jan 2016 14:49:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Jan 2016 14:49:30 +0000 (UTC) Cc: 22453@debbugs.gnu.org To: Alexander Kuleshov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 24 15:49:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aNLya-0004ci-8x for geb-bug-gnu-emacs@m.gmane.org; Sun, 24 Jan 2016 15:49:12 +0100 Original-Received: from localhost ([::1]:60698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNLyZ-0006Oy-Ky for geb-bug-gnu-emacs@m.gmane.org; Sun, 24 Jan 2016 09:49:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNLyV-0006Oa-41 for bug-gnu-emacs@gnu.org; Sun, 24 Jan 2016 09:49:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNLyQ-00043o-4G for bug-gnu-emacs@gnu.org; Sun, 24 Jan 2016 09:49:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44641) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNLyQ-00043k-0R for bug-gnu-emacs@gnu.org; Sun, 24 Jan 2016 09:49:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aNLyP-0005fh-Q8 for bug-gnu-emacs@gnu.org; Sun, 24 Jan 2016 09:49:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Jan 2016 14:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22453 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 22453-submit@debbugs.gnu.org id=B22453.145364689521747 (code B ref 22453); Sun, 24 Jan 2016 14:49:01 +0000 Original-Received: (at 22453) by debbugs.gnu.org; 24 Jan 2016 14:48:15 +0000 Original-Received: from localhost ([127.0.0.1]:32861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aNLxf-0005eh-7C for submit@debbugs.gnu.org; Sun, 24 Jan 2016 09:48:15 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57625) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aNLxd-0005eS-5M for 22453@debbugs.gnu.org; Sun, 24 Jan 2016 09:48:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNLxT-0003yZ-19 for 22453@debbugs.gnu.org; Sun, 24 Jan 2016 09:48:07 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNLxS-0003yU-Tu; Sun, 24 Jan 2016 09:48:02 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3908 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aNLxS-00008A-8L; Sun, 24 Jan 2016 09:48:02 -0500 In-reply-to: <1453617036-17528-1-git-send-email-kuleshovmail@gmail.com> (message from Alexander Kuleshov on Sun, 24 Jan 2016 12:30:36 +0600) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111916 Archived-At: > From: Alexander Kuleshov > Date: Sun, 24 Jan 2016 12:30:36 +0600 > Cc: Alexander Kuleshov > > We can easily switch to text mode from the image mode by the > pressing of C-c C-c. But sometimes, it is more useful to open > an image in hex format. This patch provides new keybinding > for the image mode - C-c C-x which works like C-c C-c, but > executes switch to the hexl-mode. Like switching to text mode, > switching to hex mode supports switching back to the image-mode. > > The patch contains following changes: > > * lisp/image-mode.el: adapted comments at the top of file; > * lisp/image-mode.el: added new menu item to the Image menu: > 'Show as hex'; > * lisp/image-mode.el: added description of the new keybinding > to the image-mode help; > * lisp/image-mode.el: all help messages in minibuffer adapted > to new keybinding; > * lisp/image-mode.el: image-toggle-hex-display function added > which checks current mode and switch into text or image mode > depends on it; > * lisp/image-mode.el: add image-mode-to-text helper for > image-toggle-as-hex and image-toggle-as-text functions. It > is built on top of image-toggle-as-text function and used > for auto-mode-alist related preparation before switching > into text or hexl mode. > > Patch tested on top of emacs-25 branch on fedora 23 with all > Linux related configured options. Thanks. This generally looks good. A few comments: . This should go to master, not emacs-25, as it's a new feature. . Please provide a ChangeLog-style commit log message for the changes (some details are in CONTRIBUTE). . Please provide an update for the user manual, which describes "C-c C-c", to describe "C-x C-x" as well. Some specific comments below. > +(defun image-mode-as-hex () > + "Set a non-image mode as major mode in combination with image minor mode. > +A non-mage major mode found from `auto-mode-alist' or fundamental mode > +displays an image file as hex. `image-minor-mode' provides the key > +\\\\[image-toggle-hex-display] to switch back to `image-mode' > +to display an image file as the actual image. > + > +You can use `image-mode-as-text' in `auto-mode-alist' when you wanto ^^^^^ A typo. > +to display an image file as text initially. Why does this sentence talk about text, when the mode is about hex display? Copy/paste mistake? > +(defun image-toggle-hex-display () > + "Toggle between image and text display. > +If the current buffer is displaying an image file as an image, > +call `image-mode-as-hex' to switch to text. Otherwise, display > +the image by calling `image-mode'." It is best to avoid referring to another command in a doc string, if you can avoid that. In this case, the reference doesn't add any useful information, so I think it should be deleted. Last, but not least, I think this contribution is too large to accept without legal paperwork. I don't see your copyright assignment on file; would you like me to send you the form so you could start the paperwork rolling? Thanks.