Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Support sequential operation which omit prefix key
Emacs Lisp Makefile
Branch: master
Failed to load latest commit information.
test Support
.ert-runner Support travis CI
.travis.yml Fix .travis.yml
Cask Fix Cask and travis
Makefile Support travis CI Tweak doc
smartrep.el Workaround for #14


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


Something went wrong with that request. Please try again.