Support sequential operation which omit prefix key
Emacs Lisp Makefile
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test Support Feb 22, 2015
.ert-runner Support travis CI Feb 21, 2015
.travis.yml Fix .travis.yml Feb 22, 2015
Cask Fix Cask and travis Feb 22, 2015
Makefile Support travis CI Feb 21, 2015 Tweak doc Mar 5, 2015
smartrep.el Workaround for #14 May 7, 2015


smartrep is a sequential command interface library. It enables the omittance of typing prefix keys. (e.g., C-c C-n C-n C-n … instead of C-c C-n C-c C-n C-c C-n …)



smartrep offers only one function smartrep-define-key. The key is bound with smartrep-define-key like:

    global-map "M-g"
  '(("n" . next-line)
    ("p" . previous-line)))

Then after typing M-g, n exetutes next-line and p executes previous-line.

If any other key is typed, the special key binding is canceled. That is, if n is typed, “n” is inserted as a character.


Control Two Buffers

Scroll another buffer. The current buffer is not changed. If you want to scroll by two lines in the other buffer, just type C-q n n.

    global-map "C-q" '(("n" . (scroll-other-window 1))
                       ("p" . (scroll-other-window -1))
                       ("N" . 'scroll-other-window)
                       ("P" . (scroll-other-window '-))
                       ("a" . (beginning-of-buffer-other-window 0))
                       ("e" . (end-of-buffer-other-window 0))))

Change Window Size

Changing Window size tends to execute the same command continuously. It is boring work. So eval this example and type C-x { { {.

    global-map "C-x"
  '(("{" . shrink-window-horizontally)
    ("}" . enlarge-window-horizontally)))

Move header on Org-mode

Org-mode has complicated prefix keys. It is so frustrating.

This idea simplifies it. If you want to move from heading to heading, then type C-c and then C-n or C-p.

    org-mode-map "C-c" '(("C-n" . (outline-next-visible-heading 1))
                         ("C-p" . (outline-previous-visible-heading 1))))

Remotely Control Firefox

You may control Firefox via Emacs.

This example enables the manipulation of Firefox to scroll up, down and more.

It requires moz.el

(autoload 'moz-minor-mode "moz" "Mozilla Minor and Inferior Mozilla Modes" t)
(moz-minor-mode t)

(defun moz-send-message (moz-command)
   (concat moz-repl-name ".pushenv('printPrompt', 'inputMode'); "
           moz-repl-name ".setenv('inputMode', 'line'); "
           moz-repl-name ".setenv('printPrompt', false); undefined; "))
   (concat moz-command
           moz-repl-name ".popenv('inputMode', 'printPrompt'); undefined;\n")))

(defun moz-scrolldown-1 ()
   (moz-send-message "goDoCommand('cmd_scrollLineDown');\n")) 

(defun moz-scrolldown ()
   (moz-send-message "goDoCommand('cmd_scrollPageDown');")) 

(defun moz-scrollup-1 ()
   (moz-send-message "goDoCommand('cmd_scrollLineUp');\n")) 

(defun moz-scrollup ()
   (moz-send-message "goDoCommand('cmd_scrollPageUp');")) 

(defun moz-top ()
   (moz-send-message "goDoCommand('cmd_scrollTop');\n"))

(defun moz-bottom ()
   (moz-send-message "goDoCommand('cmd_scrollBottom');\n"))

(require 'smartrep)

 global-map "M-g" '(("n" . moz-scrolldown-1)
                    ("N" . moz-scrolldown)
                    ("p" . moz-scrollup-1)
                    ("P" . moz-scrollup)
                    ("a" . moz-top)
                    ("e" . moz-bottom)))

Smartrep Works In Many Applications

Many applications use smartrep. Thanks!!

Related article

Similar Applications