* binding b-key to pageback behavior @ 2019-11-25 1:39 VanL 2019-11-25 2:01 ` Emanuel Berg via Users list for the GNU Emacs text editor 0 siblings, 1 reply; 8+ messages in thread From: VanL @ 2019-11-25 1:39 UTC (permalink / raw) To: help-gnu-emacs Hello. Is there a general configuration to bind b-key to pageback? What I do is the following where the b-key does not do what I would like. #+NAME: b-key-pageback-behavior #+BEGIN_SRC emacs-lisp (add-hook 'eww-mode-hook (lambda () (define-key eww-mode-map (kbd "b") 'scroll-down-command))) (add-hook 'view-mode-hook (lambda () (define-key view-mode-map (kbd "b") 'View-scroll-page-backward))) (add-hook 'help-mode-hook (lambda () (define-key help-mode-map (kbd "b") 'scroll-down-command))) (add-hook 'log-view-mode-hook (lambda () (define-key log-view-mode-map (kbd "b") 'scroll-down-command))) #+END_SRC -- © 2019 VanL gpg using EEF2 37E9 3840 0D5D 9183 251E 9830 384E 9683 B835 'If the bug bites,don't fight it.' -Nancy S. Steinhardt ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: binding b-key to pageback behavior 2019-11-25 1:39 binding b-key to pageback behavior VanL @ 2019-11-25 2:01 ` Emanuel Berg via Users list for the GNU Emacs text editor 2019-11-25 11:02 ` VanL 0 siblings, 1 reply; 8+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-11-25 2:01 UTC (permalink / raw) To: help-gnu-emacs VanL wrote: > Is there a general configuration to bind > b-key to pageback? Well, how would that work? In your code, it isn't even the same function, it is `scroll-down-command', then its `View-scroll-page-backward'... And even if it did, after evaluating it one wouldn't be able to write this very message! What you can do, is something like: (defun set-vertical-keys (map) "Set MAP keys for moving point vertically." (define-key map "i" #'previous-line) (define-key map "k" #'next-line) ) ; [1] and then, for example for the gnus-summary-mode, do (require 'gnus-sum) (set-vertical-keys gnus-summary-mode-map) Also, I'd recommend not doing this in hooks, unless you have to. [1] https://dataswamp.org/~incal/emacs-init/scroll.el -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: binding b-key to pageback behavior 2019-11-25 2:01 ` Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-11-25 11:02 ` VanL 2019-11-25 15:17 ` Emanuel Berg via Users list for the GNU Emacs text editor 0 siblings, 1 reply; 8+ messages in thread From: VanL @ 2019-11-25 11:02 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg writes: > VanL wrote: > >> Is there a general configuration to bind >> b-key to pageback? > > Well, how would that work? In your code, it > isn't even the same function, it is > `scroll-down-command', then its > `View-scroll-page-backward'... And even if it > did, after evaluating it one wouldn't be able > to write this very message! Those modes the customization is done to are for reading only in the main. SPC behaves as expected there and I look for the reverse binding to apply to b. > What you can do, is something like: > > (defun set-vertical-keys (map) > "Set MAP keys for moving point vertically." > (define-key map "i" #'previous-line) > (define-key map "k" #'next-line) ) ; [1] > > and then, for example for the > gnus-summary-mode, do > > (require 'gnus-sum) > (set-vertical-keys gnus-summary-mode-map) > > Also, I'd recommend not doing this in hooks, > unless you have to. Thanks for the suggestions. Are you able to put a LICENSE on your code? For example, I keep a CC0 empty file and.. #+NAME: example #+BEGIN_SRC c /* ,* Copyright (c) yyyy xxx <xxx@bughat.com> ,* ,* Permission to use, copy, modify, and distribute this software for any ,* purpose with or without fee is hereby granted, provided that the above ,* copyright notice and this permission notice appear in all copies. ,* ,* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ,* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ,* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ,* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ,* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ,* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ,* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ,*/ #+END_SRC > [1] https://dataswamp.org/~incal/emacs-init/scroll.el -- əə0@ 一 二 三 言 語 𝔖 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: binding b-key to pageback behavior 2019-11-25 11:02 ` VanL @ 2019-11-25 15:17 ` Emanuel Berg via Users list for the GNU Emacs text editor 2019-11-27 11:45 ` VanL 0 siblings, 1 reply; 8+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-11-25 15:17 UTC (permalink / raw) To: help-gnu-emacs VanL wrote: >>> Is there a general configuration to bind >>> b-key to pageback? >> >> Well, how would that work? In your code, it >> isn't even the same function, it is >> `scroll-down-command', then its >> `View-scroll-page-backward'... And even if >> it did, after evaluating it one wouldn't be >> able to write this very message! > > Those modes the customization is done to are > for reading only in the main. I thought by "general" you meant you looked for a way to do it without stating the specific modes and/or functions? If that's not what you meant, what is a general configuration to bind a specific key to a concept, which is implemented differently in different modes? > SPC behaves as expected there and I look for > the reverse binding to apply to b. Do `C-h k SPC' to find out what SPC does. Use this to figure out the name of the reverse function. Bind this to b: (require 'mode) (define-key mode-map "b" #'function-name) > Thanks for the suggestions. Are you able to > put a LICENSE on your code? > > For example, I keep a CC0 empty file and.. CC0 = Creative Commons 1.0? Well, I haven't read the small print... Is it enough if I put one file in the base directory of all my Elisp? -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: binding b-key to pageback behavior 2019-11-25 15:17 ` Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-11-27 11:45 ` VanL 2019-11-27 23:53 ` Emanuel Berg via Users list for the GNU Emacs text editor 0 siblings, 1 reply; 8+ messages in thread From: VanL @ 2019-11-27 11:45 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes: > VanL wrote: > >>>> Is there a general configuration to bind >>>> b-key to pageback? >>> >>> Well, how would that work? In your code, it >>> isn't even the same function, it is >>> `scroll-down-command', then its >>> `View-scroll-page-backward'... And even if >>> it did, after evaluating it one wouldn't be >>> able to write this very message! >> >> Those modes the customization is done to are >> for reading only in the main. > > I thought by "general" you meant you looked for > a way to do it without stating the specific > modes and/or functions? I was meaning 'general' in the sense where SPC functions to scroll, there, I'd like for b-key to scroll the other way. > If that's not what you meant, what is a general > configuration to bind a specific key to > a concept, which is implemented differently in > different modes? I figure the modes all fall in ultimately in two boxes, either for reading or editing. >> SPC behaves as expected there and I look for >> the reverse binding to apply to b. > > Do `C-h k SPC' to find out what SPC does. > Use this to figure out the name of the reverse > function. Bind this to b: > > (require 'mode) > (define-key mode-map "b" #'function-name) > Ah, that is neat and short. Thanks. >> Thanks for the suggestions. Are you able to >> put a LICENSE on your code? >> >> For example, I keep a CC0 empty file and.. > > CC0 = Creative Commons 1.0? I believe that one is desireable for documentation. > Well, I haven't read the small print... > > Is it enough if I put one file in the base > directory of all my Elisp? Having the license in the actual file like in 'rot13.el' is best, I believe. -- əə0@ 一 二 三 言 語 𝔖 'VLIW architecture?' ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: binding b-key to pageback behavior 2019-11-27 11:45 ` VanL @ 2019-11-27 23:53 ` Emanuel Berg via Users list for the GNU Emacs text editor 2019-11-28 5:50 ` VanL 0 siblings, 1 reply; 8+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-11-27 23:53 UTC (permalink / raw) To: help-gnu-emacs VanL wrote: > I figure the modes all fall in ultimately in > two boxes, either for reading or editing. Absolutely, but you still need to mention the individual modes (or maps) and whenever the scrolling stuff differs, that has to be explicit as well. So ultimately the result of doing that wouldn't be all that different from setting it up mode by mode. But yes it would look something like what I've already posted: (defun set-vertical-keys (map) "Set MAP keys for moving point vertically." (define-key map "i" #'previous-line) (define-key map "k" #'next-line) ) > Having the license in the actual file like in > 'rot13.el' is best, I believe. Interesting, Gnus also does that, in `gnus-summary-caesar-message'. Sounds like the kind of pleasant thing one would like to write in Elisp... -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: binding b-key to pageback behavior 2019-11-27 23:53 ` Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-11-28 5:50 ` VanL 2019-11-28 6:34 ` Emanuel Berg via Users list for the GNU Emacs text editor 0 siblings, 1 reply; 8+ messages in thread From: VanL @ 2019-11-28 5:50 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes: > VanL wrote: > >> I figure the modes all fall in ultimately in >> two boxes, either for reading or editing. > > Absolutely, but you still need to mention the > individual modes (or maps) and whenever the > scrolling stuff differs, that has to be > explicit as well. So ultimately the result of > doing that wouldn't be all that different from > setting it up mode by mode. In a more perfect world DWIM Mode just works. > But yes it would look something like what I've > already posted: > > (defun set-vertical-keys (map) > "Set MAP keys for moving point vertically." > (define-key map "i" #'previous-line) > (define-key map "k" #'next-line) ) I cargo culted the two liner and it broke Emacs's startup. Will see how this goes. Thanks. >> Having the LICENSE in the actual file like in >> 'rot13.el' is best, I believe. > > Interesting, Gnus also does that, in > `gnus-summary-caesar-message'. Sounds like the > kind of pleasant thing one would like to write > in Elisp... C17's draft N2176 page 13 point 14 is an unpleasant shocker. -- LoL, əə0@ 一 二 三 言 語 𝔖 'VLIW architecture?' G4 White 78 Black 79 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: binding b-key to pageback behavior 2019-11-28 5:50 ` VanL @ 2019-11-28 6:34 ` Emanuel Berg via Users list for the GNU Emacs text editor 0 siblings, 0 replies; 8+ messages in thread From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-11-28 6:34 UTC (permalink / raw) To: help-gnu-emacs VanL wrote: >> Absolutely, but you still need to mention >> the individual modes (or maps) and whenever >> the scrolling stuff differs, that has to be >> explicit as well. So ultimately the result >> of doing that wouldn't be all that different >> from setting it up mode by mode. > > In a more perfect world DWIM Mode just works. But it works sort of like that if only modes were to stick to the standard every-Emacs stuff. When they don't most likely it means they have reasons not to. And when that happens it must be mentioned somewhere if you want to configure it. If they didn't do it, do it yourself VanL :) > C17's draft N2176 page 13 point 14 is an > unpleasant shocker. 14 EXAMPLE 5 Rearrangement for floating-point expressions is often restricted because of limitations in precision as well as range. The implementation cannot generally apply the mathematical associative rules for addition or multiplication, nor the distributive rule, because of roundoff error, even in the absence of overflow and underflow. Likewise, implementations cannot generally replace decimal constants in order to rearrange expressions. In the following fragment, rearrangements suggested by mathematical rules for real numbers are often not valid (see F.9). double x, y, z; /* ... */ x = (x * y) * z; // not equivalent to x *= y * z; z = (x - y) + y; // not equivalent to z = x; z = x + x * y; // not equivalent to z = x * (1.0 + y); y = x / 5.0; // not equivalent to y = x * 0.2; Don't download this: http://www2.open-std.org/JTC1/SC22/WG14/www/abq/c17_updated_proposed_fdis.pdf -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-11-28 6:34 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-11-25 1:39 binding b-key to pageback behavior VanL 2019-11-25 2:01 ` Emanuel Berg via Users list for the GNU Emacs text editor 2019-11-25 11:02 ` VanL 2019-11-25 15:17 ` Emanuel Berg via Users list for the GNU Emacs text editor 2019-11-27 11:45 ` VanL 2019-11-27 23:53 ` Emanuel Berg via Users list for the GNU Emacs text editor 2019-11-28 5:50 ` VanL 2019-11-28 6:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
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.