emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Insert character pairs


From: Juri Linkov
Subject: Re: Insert character pairs
Date: Sat, 01 May 2004 11:19:32 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

> Also it adds the functions for some most frequent character pairs
> to be able to bind them to the keys like M-", M-', M-`, M-[.

It seems all these functions might be added only with adding
the corresponding key bindings at the same time.  But some keys
are already bound: M-' to abbrev-prefix-mark, M-` to tmm-menubar,
M-{ to backward-paragraph.  M-" and M-[ are unbound, but they
might be reserved to something different.

Anyhow, the function `open-pair' allows everyone to bind a key
to `open-pair' with desired character arguments in .emacs.

BTW, I didn't find anywhere in Emacs a command that promotes
a list up in the tree.  It would be useful to add this command
to `emacs-lisp/lisp.el':

(defun promote-list (&optional arg)
  "Promote expressions higher up the tree."
  (interactive "p")
  (let ((str (if (and transient-mark-mode mark-active)
                 (buffer-substring (region-beginning) (region-end))
               (buffer-substring
                (point)
                (save-excursion (forward-sexp arg) (point))))))
    (backward-up-list 1)
    (delete-region (point) (save-excursion (forward-sexp 1) (point)))
    (save-excursion (insert str))))

Maybe, a better name is `move-up-list' (however, not good since
the word `move' often means `move the point') or `lift-up-list'?

The command `promote-list' is basically opposite to `insert-parentheses',
so another possible name is `remove-parentheses', but it is misleading,
because it removes more than only enclosing parentheses.

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]