emacs-wiki-discuss
[Top][All Lists]
Advanced

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

[emacs-wiki-discuss] Re: Tag completion.


From: Michael Olson
Subject: [emacs-wiki-discuss] Re: Tag completion.
Date: Fri, 01 Apr 2005 13:23:41 -0500
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

Andrea Riciputi <address@hidden> writes:

> I'm trying out emacs-wiki, and I'm quite satisfied with it. However I'm 
> very lazy ;-) and I've got tired very early to type all these tags such 
> as <verse>, <example> and so on.
>
> In particular I was not able to create a list with all the emacs-wiki 
> tag automatically, so I have populated it by hand (only few tags are 
> present in the attached file, indeed). Is anyone able to do it?

To do that, (mapcar 'car emacs-wiki-markup-tags) seems to work.

Here's a slightly modified version of what you wrote.  I haven't
tested it explicitly, but it looks right :^) .

I prefer to have the function mapped to C-c C-i (or C-c TAB) for the
sake of forward-compatibility with Muse.  Would it be okay for me to
include this code with emacs-wiki?

(defcustom emacs-wiki-default-tag "example"
  "*The default tag when creating new ones with `emacs-wiki-insert-tag'."
  :group 'emacs-wiki-publish
  :type 'string)
(make-variable-buffer-local 'emacs-wiki-default-tag)

(defvar emacs-wiki-tag-history nil)

(defun emacs-wiki-insert-tag ()
  "Insert a tag pair with blank line between them.
The cursor is placed between the tags."
  (interactive)
  (let ((markup-tag (completing-read
                     (concat "Tag: (default "
                             emacs-wiki-default-tag
                             ") ")
                     (mapcar 'car emacs-wiki-markup-tags)
                     nil nil nil
                     'emacs-wiki-tag-history)))
    (if (zerop (length markup-tag))
        (setq markup-tag emacs-wiki-default-tag)
      (setq emacs-wiki-default-tag markup-tag))

    (insert (concat "\n<" markup-tag ">\n\n</" markup-tag ">\n")))
  (forward-line -2))

(local-set-key (kbd "C-c C-i") 'emacs-wiki-insert-tag)

-- 
Michael Olson -- FSF Associate Member #652 -- http://www.mwolson.org/
Jabber: mwolson_at_hcoop.net -- IRC: mwolson on freenode.net: #muse, #pulug
  /` |\ | | |
 |_] | \| |_|   Interests: anime, Debian GNU/Linux, XHTML, wiki, Lisp

Attachment: pgp3NIcHgwm72.pgp
Description: PGP signature


reply via email to

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