help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Seeking advice on writing a "line-based" major mode


From: Emanuel Berg
Subject: Re: Seeking advice on writing a "line-based" major mode
Date: Sat, 20 Jun 2015 03:28:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Here is a hybrid: buttons, but data as the button
labels - that's clever, ey?

(defun find-file-button-f (button)
  (find-file (button-label button)) )

(define-button-type 'find-file-button
  'action 'find-file-button-f
  'follow-link t)

(defvar *files* '("~/.emacs" "~/.gnus" "~/.zshrc" "~/.zshenv"))

(insert "Hit RET on these buttons to visit the file.\n"
        "If there isn't such a file, open an empty buffer with that name.\n\n")

(save-excursion ; doesn't work if not compiled (see last comment)
  (dolist (f *files*)
    (insert-text-button f :type 'find-file-button)
    (insert "\n") ))

;; execute:
;;
;;    emacs -Q -l button.el
;;
;; or:
;;
;;    emacs --batch -f batch-byte-compile button.el
;;    emacs -Q -l button.elc

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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