Loading repository data…
Loading repository data…
takaxp / repository
A Moom port to Emacs - Make your dominant hand FREE from your mouse
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
#+title: Moom - A Moom port to GNU Emacs #+startup: showall
[[https://melpa.org/#/moom][file:https://melpa.org/packages/moom-badge.svg]]
/Make your dominant hand FREE from your mouse/ :)
After installing =moom.el= and =moom-font.el= (optional), activate =moom= by =(moom-mode 1)= in your =init.el=. This module requires [[https://www.gnu.org/software/emacs/][GNU Emacs]] 25.1 or later.
#+begin_src emacs-lisp (with-eval-after-load "moom" ;; add settings here ... ;; (setq moom-use-font-module nil) (moom-mode 1)) #+end_src
or
#+begin_src emacs-lisp (when (require 'moom nil t) ;; add settings here ... ;; (setq moom-use-font-module nil) (moom-mode 1)) #+end_src
If you don't want to change font size when resizing frame size, please configure moom-use-font-module before activating =moom-mode= by (moom-mode 1).
#+begin_quote [!NOTE] =moom= can display a command list supported by =transient.el=. See [[https://github.com/takaxp/moom?tab=readme-ov-file#transientel-support][transient.el support]] section. #+end_quote
#+caption: demo for moving and zooming, frame maximized [[https://github.com/takaxp/contents/blob/master/moom/demo1.gif]]
Note - This module has basically been tested on macOS High Sierra, Catalina, BigSur, and [[https://www.apple.com/jp/macos/][Monterey]] with combinations of two Full HD (1920x1080) monitors and one 4K monitor. Additionally, tested in Windows 10 and Linux (Ubuntu 20.04 with Emacs 26.3, CentOS 8.2, and openSUSE 15.1) with GTK, but they may still have some issues.
** Move
*** Horizontal shift
*** Centering
** Fit
*** edge
*** center line
** Expand
These functions will not change font size in a frame.
*** split and delete window
** Fill screen
These functions normally change font size in a frame. But the behavior can be changed by =M-x moom-toggle-font-module=.
Note - If you find any problems around font settings when resizing the Emacs frame, you can easily disable the feature in =moom-font.el=. Just change =moom-use-font-module= to nil in your init.el. =M-x moom-toggle-font-module= can also control if the font module is utilized or not.
#+begin_src emacs-lisp (with-eval-after-load "moom" (setq moom-use-font-module nil)) #+end_src
** Other functions
(obsoleted)
*** How to setup screen margins
For macOS users, the default margin is =(23 0 0 0)=. And for other system types, it is also automatically configured using combination of =frame-monitor-geometry= and =frame-monitor-workarea= when =moom-mode= is activated. But the actual work area is probably depends on user environment. Therefore, =moom.el= provides a capability that you can control the actual active region on your screen by setting =moom-user-margin= in init.el.
#+begin_src emacs-lisp (setq moom-user-margin '(50 50 50 50)) ;; {top, bottom, left, right} (moom-mode 1) #+end_src
Each value means a margin from the top, bottom, left, and right edge of your screen. If you want to test some combinations of the margins, then =M-x moom-check-user-margin= could be helpful since it provides an interactive way to check the actual region on a screen and save the tested value for the Emacs session.
It is also useful to use =moom-update-user-margin= directly by putting new margin or interactively. Note that =moom-check-user-margin= internally calls =moom-update-user-margin=.
#+begin_src emacs-lisp (moom-update-user-margin '(50 50 50 50)) ;; {top, bottom, left, right} #+end_src
The =moom-check-user-margin= and =moom-update-user-margin= will change =moom-user-margin= in an Emacs session, however, the updated margins will NOT be saved as a permanent value, so please configure the margins in your init.el explicitly for the next session.
No need to load =moom-font.el= explicitly. If the package is installed in your system, then it will be activated automatically. The package is basically provided for the users who rely on Japanese fonts. And if you will never user the font module without deleting =moom-font.el=, please configure =moom-use-font-module= to nil before activating =moom-mode= by =(moom-mode 1)=.
#+caption: demo for increasing and decreasing fonts, frame maximized [[https://github.com/takaxp/contents/blob/master/moom/demo2.gif]]
** Setting
Font names for ASCII and Japanese font are now automatically identified without user action when =moom-mode= is activated. But =moom-font-ascii-scale= and =moom-font-ja-scale= should be configured still manually according to your environment. If you don't satisfy the automatically configured setting for ASCII and Japanese font, then please set these parameters manually by functions of =moom-font-ascii= or =moom-font-ja=.
The default values for =moom-font-ascii-scale= and =moom-font-ja-scale= are =1.0= and =1.2= respectably. The scaling factors for each font are integrated into =face-font-rescale-alist= properly.
If you don't know which fonts are used in Emacs frame, you can easily check them by M-x moom-font-print-name-at-point or M-x describe-char on a character.
The following text is an example message when you type M-x moom-font-print-name-at-point.
#+begin_src txt [moom-font] It’s "Menlo". Call ‘moom-font-ja’ or ‘moom-font-ascii’ with "Menlo". #+end_src
After you identify the font names in a buffer, then please configure them as follows:
#+begin_src emacs-lisp (with-eval-after-load "moom-font" (setq moom-font-ascii-scale 1.0) (setq moom-font-ja-scale 1.2) (moom-font-ascii "Menlo") ;; Ricty Diminished, Inconsolata (moom-font-ja "Migu 2M")) ;; Hiragino Maru Gothic Pro #+end_src
Normally, ASCII and Japanese fonts will be updated when resizing fonts. But if you provide an optional argument to =moom-font-ascii= or =moom-font-ja=, the given font is immediately applied and reflected in each buffer. See the following example setting.
#+begin_src emacs-lisp (with-eval-after-load "moom-font" (moom-font-ascii "Menlo" '(:immediate t)) (moom-font-ja "Migu 2M" '(:immediate t))) #+end_src
When you find the column exceeds 80 when the frame is maximized, then configure =moom-scaling-gradient= properly. It depends on ASCII font type. For instance, 1.66 (default) for Menlo, Monaco, 2.0 for Inconsolata, MS Gothic, and TakaoGothic. Please see the following section.
*** Font table
You can also use =M-x moom-generate-font-table= to identify appropriate values of =moom-scaling-gradient=, and additionally =moom-font-table=. After calling =moom-generate-font-table=, the current buffer will be changed to the moom-font buffer. Please follow the instructions described in that buffer.
Here is an example. Monaco is used for ASCII font and Migu 2M is used for Japanese font in these images. The upper image shows a gap between strings in ASCII and Japanese at the first line, the font table is not defined in this case. On the other hand, the lower image shows no gap since the font table is utilized to identify the correct size of font. You can freely customize the font table in you init.el for your convenience.
#+caption: Without font table (Monaco: 13pt 8px) [[https://github.com/takaxp/contents/blob/master/moom/monaco-13pt8px.png]]
#+caption: With font table (Monaco: 14pt 8px) [[https://github.com/takaxp/contents/blob/master/moom/monaco-14pt8px.png]]
** Resize font
** Font setting
** Other functions
#+caption: User variables in moom.el | | default | type | |--------------------------------------+------------------------------------+---------| | moom-move-frame-pixel-offset | '(0 . 0) | sexp | | moom-min-frame-height | 16 | integer | | moom-init-line-spacing | line-spacing | float | | moom-min-line-spacing | 0.1 | float | | moom-max-line-spacing | 0.8 | float | | moom-frame-width-single | 80 | integer | | moom-frame-width-double | 163 | integer | | moom-horizontal-shifts | '(200 200) | choice | | moom-fill-band-options | '(:direction vertical :range 50.0) | plist | | moom-scaling-gradient | 1.66 | float | | moom-moom-display-line-numbers-width | 6 | integer | | moom-command-with-centering | '(split delete) | list | | moom-user-margin | '(0 0 0 0) | list | | moom-use-font-module | t | boolean | | moom-command-history-length | 100 | integer | | moom-verbose | nil | boolean | | moom-lighter | Moom | string |
*** moom-command-with-centering
The following commands will centerize the frame position in display if =moom-command-with-centering= includes the corresponding values. If you specify =nil= then no commands will centerize the frame.
| Value | Command | |------------+------------------------------------| | split | moom-split-window | | delete | moom-delete-windows | | single | moom-change-frame-width-single | | double | moom-change-frame-width-double | | half-again | moom-change-frame-width-half-again |
** moom-font.el
#+caption: User variables in moom-font.el | | default | type | |-----------------------+---------+---------------------------------| | moom-font-ja-scale | 1.2 | float | | moom-font-ascii-scale | 1.0 | float | | moom-font-table | nil | (repeat (list integer integer)) | | moom-font-verbose | nil | boolean |
Note - (breaking changes at v1.2.1) moom-font-init-size was hidden. The size