fortranモード用
    
; コンパイルコマンド名
(defvar *fortran-command* "f77")

(defun tags-find-fortran-point (class name functionp point)
  (goto-char (- point *jump-tag-limit*))
  (and (scan-buffer (concat "^[ \t]*subroutine[ \t]+"
			    (regexp-quote name)
			    "\\($\\|[ \t\r\n\f#]\\)")
		    :regexp t :limit (+ point *jump-tag-limit*) :case-fold t) 
       (point)))

(pushnew '(fortran-maketags "*.f" "*.for" "*.inc") *maketags-list* :key #'car)

(defun fortran-maketags (file count)
  (goto-char (point-min))
  (while (scan-buffer "^[ \t]*subroutine[ \t]+" :regexp t :tail t :case-fold t)
    (do-events)
    (let ((opoint (point)))
      (skip-chars-forward "A-Za-z0-9_")
      (unless (= opoint (point))
	(format t "~A~A~D" (buffer-substring opoint (point)) file opoint )
	(incf count))))
  count)

(defvar *fortran-comment-formats*
  (compile-regexp-keyword-list
   '(("^c"
      t (:keyword :comment :line))
     ("コメント" t (:keyword :tag :underline))
    )))

(defun my-fortran-uncomment ()
  (interactive)
  (let ((save-point (make-marker))
	(com (regexp-quote fortran-comment-region)))
    (set-marker save-point (point))
    (goto-bol)
    (if (looking-at com)
	(progn
	  (delete-region (point) (match-end 0))
	  (while (and (forward-line 1)
		      (looking-at com))
	    (delete-region (point) (match-end 0)))
	  (goto-char save-point)
	  (while (and (forward-line -1)
		      (looking-at com))
	    (delete-region (point) (match-end 0)))
	  (goto-char save-point)
	  (delete-marker save-point)))))


(defun fortran-mode-addin()
  (abbrev-mode)
  (make-local-variable 'tags-find-target)
  (setq tags-find-target #'ed::tags-find-target-simple)
  (make-local-variable 'tags-find-point)
  (setq tags-find-point #'tags-find-fortran-point)
  (make-local-variable 'regexp-keyword-list)
  (setq regexp-keyword-list *fortran-comment-formats*)
)
xyzzyの便利な機能,使い方