all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] image-mode.el (image-kill-buffer): New command.
@ 2015-02-04 22:11 Artur Malabarba
  2015-02-04 23:04 ` Artur Malabarba
  0 siblings, 1 reply; 5+ messages in thread
From: Artur Malabarba @ 2015-02-04 22:11 UTC (permalink / raw)
  To: emacs-devel

Given how similar docview and image-mode are, I'm always taken
off-guard when I run into a small difference. This patch fixes one.

k kills the buffer in docview, and I see no reason why it wouldn't do
the same in image-mode. If nobody opposes this patch I'll merge it
myself.

Cheers to all,



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

* Re: [PATCH] image-mode.el (image-kill-buffer): New command.
  2015-02-04 22:11 [PATCH] image-mode.el (image-kill-buffer): New command Artur Malabarba
@ 2015-02-04 23:04 ` Artur Malabarba
  2015-02-05  2:15   ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Artur Malabarba @ 2015-02-04 23:04 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

Forgot to attach the patch. Sorry.

2015-02-04 20:11 GMT-02:00 Artur Malabarba <bruce.connor.am@gmail.com>:
> Given how similar docview and image-mode are, I'm always taken
> off-guard when I run into a small difference. This patch fixes one.
>
> k kills the buffer in docview, and I see no reason why it wouldn't do
> the same in image-mode. If nobody opposes this patch I'll merge it
> myself.
>
> Cheers to all,

[-- Attachment #2: 0001-image-mode.el-image-kill-buffer-New-command.patch --]
[-- Type: text/x-patch, Size: 1711 bytes --]

From fa7711bf92aaf86087af5fdfbb5e25ad1540fabb Mon Sep 17 00:00:00 2001
From: Artur Malabarba <bruce.connor.am@gmail.com>
Date: Wed, 4 Feb 2015 18:02:14 -0200
Subject: [PATCH] * image-mode.el (image-kill-buffer): New command.

---
 lisp/ChangeLog     | 3 +++
 lisp/image-mode.el | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9e473e2..15d79b4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -14,6 +14,9 @@
 
 2015-02-04  Artur Malabarba  <bruce.connor.am@gmail.com>
 
+	* image-mode.el (image-kill-buffer): New command.
+	(image-mode-map): Bind it to k.
+
 	* emacs-lisp/package.el (package-delete): Remove package from
 	`package-selected-packages' even if it can't be deleted.
 	(package-installed-p): Accept package-desc objects.
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 9e527f1..8ea1a2b 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -380,6 +380,7 @@ call."
     (define-key map "a-" 'image-decrease-speed)
     (define-key map "a0" 'image-reset-speed)
     (define-key map "ar" 'image-reverse-speed)
+    (define-key map "k" 'image-kill-buffer)
     (define-key map [remap forward-char] 'image-forward-hscroll)
     (define-key map [remap backward-char] 'image-backward-hscroll)
     (define-key map [remap right-char] 'image-forward-hscroll)
@@ -722,6 +723,12 @@ the image by calling `image-mode'."
       (image-mode-as-text)
     (image-mode)))
 
+(defun image-kill-buffer ()
+  "Kill the current buffer."
+  (interactive)
+  (when (eq major-mode 'image-mode)
+    (kill-buffer (current-buffer))))
+
 (defun image-after-revert-hook ()
   (when (image-get-display-property)
     (image-toggle-display-text)
-- 
2.2.2


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

* Re: [PATCH] image-mode.el (image-kill-buffer): New command.
  2015-02-04 23:04 ` Artur Malabarba
@ 2015-02-05  2:15   ` Stefan Monnier
  2015-02-05  8:17     ` Artur Malabarba
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2015-02-05  2:15 UTC (permalink / raw)
  To: Artur Malabarba; +Cc: emacs-devel

>> Given how similar docview and image-mode are, I'm always taken
>> off-guard when I run into a small difference. This patch fixes one.

They should share more behavior *and* code.

> +	* image-mode.el (image-kill-buffer): New command.
> +	(image-mode-map): Bind it to k.

Could you try and remove the "k" binding in doc-view-map (i.e. let it
inherit from image-mode-map)?


        Stefan



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

* Re: [PATCH] image-mode.el (image-kill-buffer): New command.
  2015-02-05  2:15   ` Stefan Monnier
@ 2015-02-05  8:17     ` Artur Malabarba
  2015-02-05 14:03       ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Artur Malabarba @ 2015-02-05  8:17 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

> Could you try and remove the "k" binding in doc-view-map (i.e. let it
> inherit from image-mode-map)?
>

Unfortunately it won't be that simple. Docview's command is different
because it also kills the conversion process.

[-- Attachment #2: Type: text/html, Size: 292 bytes --]

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

* Re: [PATCH] image-mode.el (image-kill-buffer): New command.
  2015-02-05  8:17     ` Artur Malabarba
@ 2015-02-05 14:03       ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2015-02-05 14:03 UTC (permalink / raw)
  To: Artur Malabarba; +Cc: emacs-devel

>> Could you try and remove the "k" binding in doc-view-map (i.e. let it
>> inherit from image-mode-map)?
> Unfortunately it won't be that simple. Docview's command is different
> because it also kills the conversion process.

I know, but I think it will either "just work" (thanks to the
kill-buffer-hook), or can be made to work.


        Stefan



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

end of thread, other threads:[~2015-02-05 14:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-04 22:11 [PATCH] image-mode.el (image-kill-buffer): New command Artur Malabarba
2015-02-04 23:04 ` Artur Malabarba
2015-02-05  2:15   ` Stefan Monnier
2015-02-05  8:17     ` Artur Malabarba
2015-02-05 14:03       ` Stefan Monnier

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.