unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15466: 24.3.50; [PATCH] Add some keybindings for doc-view-mode
@ 2013-09-26 14:14 Xue Fuqiao
  2013-09-26 18:05 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Xue Fuqiao @ 2013-09-26 14:14 UTC (permalink / raw)
  To: 15466

severity minor
tags patch

This patch adds some keybindings to doc-view-mode:

=== modified file 'lisp/doc-view.el'
*** lisp/doc-view.el    2013-09-18 04:38:49 +0000
--- lisp/doc-view.el    2013-09-26 14:10:57 +0000
***************
*** 405,411 ****
--- 405,415 ----
      (define-key map (kbd "RET")       'image-next-line)
      ;; Zoom in/out.
      (define-key map "+"               'doc-view-enlarge)
+     (define-key map "="               'doc-view-enlarge)
+     (define-key map (kbd "C-x C-+")   'doc-view-enlarge)
+     (define-key map (kbd "C-x C-=")   'doc-view-enlarge)
      (define-key map "-"               'doc-view-shrink)
+     (define-key map (kbd "C-x C--")   'doc-view-shrink)
      ;; Fit the image to the window
      (define-key map "W"               'doc-view-fit-width-to-window)
      (define-key map "H"               'doc-view-fit-height-to-window)



-- 
Best regards, Xue Fuqiao.
http://www.gnu.org/software/emacs/





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

* bug#15466: 24.3.50; [PATCH] Add some keybindings for doc-view-mode
  2013-09-26 14:14 bug#15466: 24.3.50; [PATCH] Add some keybindings for doc-view-mode Xue Fuqiao
@ 2013-09-26 18:05 ` Stefan Monnier
  2013-09-26 18:38   ` Tassilo Horn
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2013-09-26 18:05 UTC (permalink / raw)
  To: Xue Fuqiao, Tassilo Horn; +Cc: 15466

>       (define-key map (kbd "RET")       'image-next-line)
>       ;; Zoom in/out.
>       (define-key map "+"               'doc-view-enlarge)
> +     (define-key map "="               'doc-view-enlarge)
> +     (define-key map (kbd "C-x C-+")   'doc-view-enlarge)
> +     (define-key map (kbd "C-x C-=")   'doc-view-enlarge)
>       (define-key map "-"               'doc-view-shrink)
> +     (define-key map (kbd "C-x C--")   'doc-view-shrink)
>       ;; Fit the image to the window
>       (define-key map "W"               'doc-view-fit-width-to-window)
>       (define-key map "H"               'doc-view-fit-height-to-window)

I think it's OK (unless Tassilo disagrees, obviously), but it needs some
comments about why it's added (for the = binding, I guess it's because
it's the "unshifted +", which for the other it's to override
text-scale-adjust).
Also, maybe instead of rebinding C-x C-+, we should remap text-scale-adjust.


        Stefan





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

* bug#15466: 24.3.50; [PATCH] Add some keybindings for doc-view-mode
  2013-09-26 18:05 ` Stefan Monnier
@ 2013-09-26 18:38   ` Tassilo Horn
  2013-09-26 19:08     ` Tassilo Horn
  0 siblings, 1 reply; 6+ messages in thread
From: Tassilo Horn @ 2013-09-26 18:38 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Xue Fuqiao, 15466

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>       (define-key map (kbd "RET")       'image-next-line)
>>       ;; Zoom in/out.
>>       (define-key map "+"               'doc-view-enlarge)
>> +     (define-key map "="               'doc-view-enlarge)
>> +     (define-key map (kbd "C-x C-+")   'doc-view-enlarge)
>> +     (define-key map (kbd "C-x C-=")   'doc-view-enlarge)
>>       (define-key map "-"               'doc-view-shrink)
>> +     (define-key map (kbd "C-x C--")   'doc-view-shrink)
>>       ;; Fit the image to the window
>>       (define-key map "W"               'doc-view-fit-width-to-window)
>>       (define-key map "H"               'doc-view-fit-height-to-window)
>
> I think it's OK (unless Tassilo disagrees, obviously),

No, it's fine with me.

> Also, maybe instead of rebinding C-x C-+, we should remap
> text-scale-adjust.

Yeah

  (define-key map [remap text-scale-adjust] 'doc-view-enlarge)
  (define-key map (kbd "C-x C--")           'doc-view-shrink)

should be equivalent.  Well, except that C-x C-0 would also enlarge.  It
wouldn't be bad to have a command to reset to the original size.  That
shouldn't be hard to do.  In the non-ImageMagick case, it's killing the
buffer-local value of doc-view-resolution and reconverting, and in the
ImageMagick case it's just killing the local value of
doc-view-image-width and re-inserting the image with
doc-view-insert-image.

Bye,
Tassilo





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

* bug#15466: 24.3.50; [PATCH] Add some keybindings for doc-view-mode
  2013-09-26 18:38   ` Tassilo Horn
@ 2013-09-26 19:08     ` Tassilo Horn
  2013-09-27  6:50       ` Tassilo Horn
  0 siblings, 1 reply; 6+ messages in thread
From: Tassilo Horn @ 2013-09-26 19:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Xue Fuqiao, 15466-done

Tassilo Horn <tsdh@gnu.org> writes:

> Yeah
>
>   (define-key map [remap text-scale-adjust] 'doc-view-enlarge)
>   (define-key map (kbd "C-x C--")           'doc-view-shrink)
>
> should be equivalent.  Well, except that C-x C-0 would also enlarge.  It
> wouldn't be bad to have a command to reset to the original size.

I've committed the bindings and added a new command
doc-view-reset-zoom-level in revno 114463 on the trunk.  So now all
text-scaling key bindings work appropriately in doc-view buffers.

I'm closing the bug.

Bye,
Tassilo





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

* bug#15466: 24.3.50; [PATCH] Add some keybindings for doc-view-mode
  2013-09-26 19:08     ` Tassilo Horn
@ 2013-09-27  6:50       ` Tassilo Horn
  2013-09-27 13:04         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Tassilo Horn @ 2013-09-27  6:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Xue Fuqiao, 15466-done

Tassilo Horn <tsdh@gnu.org> writes:

>>   (define-key map [remap text-scale-adjust] 'doc-view-enlarge)
>>   (define-key map (kbd "C-x C--")           'doc-view-shrink)
>>
>> should be equivalent.  Well, except that C-x C-0 would also enlarge.  It
>> wouldn't be bad to have a command to reset to the original size.
>
> I've committed the bindings and added a new command
> doc-view-reset-zoom-level in revno 114463 on the trunk.  So now all
> text-scaling key bindings work appropriately in doc-view buffers.

Of course the above was a bit bogus in case a user has bound
text-scale-adjust to something different that C-x C-<+,=,-,0>.  So now
I've added a new command `doc-view-scale-adjust' that dispatches the
action to take by the key binding like `text-scale-adjust' does, and
that's now the remapping binding (revno 114464).

Bye,
Tassilo





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

* bug#15466: 24.3.50; [PATCH] Add some keybindings for doc-view-mode
  2013-09-27  6:50       ` Tassilo Horn
@ 2013-09-27 13:04         ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-09-27 13:04 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: Xue Fuqiao, 15466-done

> Of course the above was a bit bogus in case a user has bound
> text-scale-adjust to something different that C-x C-<+,=,-,0>.  So now
> I've added a new command `doc-view-scale-adjust' that dispatches the
> action to take by the key binding like `text-scale-adjust' does, and
> that's now the remapping binding (revno 114464).

Great, thanks,


        Stefan





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

end of thread, other threads:[~2013-09-27 13:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-26 14:14 bug#15466: 24.3.50; [PATCH] Add some keybindings for doc-view-mode Xue Fuqiao
2013-09-26 18:05 ` Stefan Monnier
2013-09-26 18:38   ` Tassilo Horn
2013-09-26 19:08     ` Tassilo Horn
2013-09-27  6:50       ` Tassilo Horn
2013-09-27 13:04         ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).