view lisp/forms-d2.el @ 50435:2c804de1a942

(find-file-of-tag-noselect, find-file-of-tag): New helper functions. (snarf-tag-function): Doc string is changed. Explained about new optional argument, `use-explicit'. (etags-snarf-tag): Added one optional argument `use-explicit'. (file-of-tag-function): Doc string is changed. Explained about new optional argument, `relative'. (file-of-tag): Doc string is changed. Explained about new optional argument, `relative'. Pass `relative' to `file-of-tag-function'. (etags-file-of-tag): Added new argument `relative`. (list-tags): Set `buffer-read-only' to t after making the major mode apropos-mode. (etags-list-tags): Used `make-text-button' instead of `add-text-properties'. Used `snarf-tag-function', `goto-tag-location-function' and `find-file-of-tag' instead of `find-tag-other-window' (it's too simple). (find-tag-in-order): Used `find-file-of-tag-noselect' instead of `find-file'. (etags-tags-apropos): Used `find-file-of-tag-noselect' instead of `find-file'. Do not use `etags-goto-tag-location` directly; use `goto-tag-location-function' instead. Print relative file paths instead of complete ones in *Tags List* buffer, so lines in the buffer become shorter. (etags-tags-apropos-additional): Use `make-text-button' instead of `add-text-properties'.
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 04 Apr 2003 20:01:36 +0000
parents 37645a051842
children 695cf19ef79e d7ddb3e565de
line wrap: on
line source

;;; forms-d2.el --- demo forms-mode -*- no-byte-compile: t -*-

;; Author: Johan Vromans <jvromans@squirrel.nl>
;; Created: 1989

;; This file is part of GNU Emacs.

;;; Commentary:

;; This sample forms exploit most of the features of forms mode.

;;; Code:

;; Set the name of the data file.
(setq forms-file "forms-d2.dat")

;; Use 'forms-enumerate' to set field names and number thereof.
(setq forms-number-of-fields
      (forms-enumerate
       '(arch-newsgroup			; 1
	 arch-volume			; 2
	 arch-issue			; and ...
	 arch-article			; ... so
	 arch-shortname			; ... ... on
	 arch-parts
	 arch-from
	 arch-longname
	 arch-keywords
	 arch-date
	 arch-remarks)))

;; The following functions are used by this form for layout purposes.
;;
(defun arch-tocol (target &optional fill)
  "Produces a string to skip to column TARGET. Prepends newline if needed.
The optional FILL should be a character, used to fill to the column."
  (if (null fill)
      (setq fill ? ))
  (if (< target (current-column))
      (concat "\n" (make-string target fill))
    (make-string (- target (current-column)) fill)))
;;
(defun arch-rj (target field &optional fill)
  "Produces a string to skip to column TARGET minus the width of field FIELD.
Prepends newline if needed. The optional FILL should be a character,
used to fill to the column."
  (arch-tocol (- target (length (nth field forms-fields))) fill))

;; Record filters.
;;
(defun arch-new-record-filter (the-record)
  "Form a new record with some defaults."
  (aset the-record arch-from (user-full-name))
  (aset the-record arch-date (current-time-string))
  the-record				; return it
)
(setq forms-new-record-filter 'arch-new-record-filter)

;; The format list.
(setq forms-format-list
     (list
       "====== Public Domain Software Archive ======\n\n"
       arch-shortname
       " - "			arch-longname
       "\n\n"
       "Article: "		arch-newsgroup
       "/"			arch-article
       " "
       '(arch-tocol 40)
       "Issue: "		arch-issue
       " "
       '(arch-rj 73 10)
       "Date: "			arch-date
       "\n\n"
       "Submitted by: "		arch-from
       "\n"
       '(arch-tocol 79 ?-)
       "\n"
       "Keywords: "		arch-keywords
       "\n\n"
       "Parts: "		arch-parts
       "\n\n====== Remarks ======\n\n"
       arch-remarks
     ))

;; That's all, folks!

;;; forms-d2.el ends here