[erlang-questions] Erlang Mode Mavens: customizations?

Adam Lindberg <>
Wed May 14 13:33:33 CEST 2008


On Wed, May 14, 2008 at 9:56 AM, Jachym Holecek <>
wrote:

> + tabbar mode.
>

+ erlware-mode (http://code.google.com/p/erlware-mode/)

My personal favourites are (add to your init.el/custom.el etc):

(defun duplicate-one-line ()
  "Duplicate the current line. There is a little bug: when current line is
the last line of the buffer, this will not work as expected. Anyway, that's
ok for me."
  (interactive)
  (let ((start (progn (beginning-of-line) (point)))
    (end (progn (next-line 1) (beginning-of-line) (point))))
    (insert-buffer-substring (current-buffer) start end)
    (forward-line -1)))
(global-set-key (kbd "C-=") 'duplicate-one-line)

(defun move-one-line-downward ()
  "Move current line downward once."
  (interactive)
  (forward-line)
  (transpose-lines 1)
  (forward-line -1))
(global-set-key (kbd "C-down") 'move-one-line-downward)

(defun move-one-line-upward ()
  "Move current line upward once."
  (interactive)
  (transpose-lines 1)
  (forward-line -2))
(global-set-key (kbd "C-up") 'move-one-line-upward)

(defvar previous-column nil "Save the column position")
(defun nuke-line ()
  "Kill current line and restore column position."
  (interactive)
  (setq previous-column (current-column))
  (kill-entire-line 1)
  (move-to-column previous-column))
(global-set-key [(shift delete)] 'nuke-line)

This makes Ctrl+= duplicate the current line, very handy! Ctrl+Up switches
the current and the line above and Ctrl+Down switches the current and the
line below enabling you to move a line up and down in the buffer. Also
handy! Lastly Shift+Delete is bound to kill the whole line and saving the
column position.

Taken from: http://exceedhl.wordpress.com/2006/07/13/tweak-emacs/

This one makes Shift+Backspace delete all whitespace around the cursor:
(global-set-key (kbd "S-BS") 'delete-horizontal-space)

The perfect challenge for a cunning elisp-developer would be to enhance the
move one line upward and downward functions to take care of Erlang's line
ending characters, i.e. so that commas, semicolons and periods aren't moved
together with the line.

Cheers!
Adam
--
Adam Lindberg
http://www.erlang-consulting.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080514/f4b4411e/attachment.html>


More information about the erlang-questions mailing list