Function: srecode-semantic-handle-:file

srecode-semantic-handle-:file is a byte-compiled function defined in args.el.gz.

Signature

(srecode-semantic-handle-:file DICT)

Documentation

Add macros into the dictionary DICT based on the current :file.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/srecode/args.el.gz
;;; :file ARGUMENT HANDLING
;;
;; When a :file argument is required, fill the dictionary with
;; information about the file Emacs is editing at the time of
;; insertion.
(defun srecode-semantic-handle-:file (dict)
  "Add macros into the dictionary DICT based on the current :file."
  (let* ((bfn (buffer-file-name))
	 (file (file-name-nondirectory bfn))
	 (dir (file-name-directory bfn)))
    (srecode-dictionary-set-value dict "FILENAME" file)
    (srecode-dictionary-set-value dict "FILE" (file-name-sans-extension file))
    (srecode-dictionary-set-value dict "EXTENSION" (file-name-extension file))
    (srecode-dictionary-set-value dict "DIRECTORY" dir)
    (srecode-dictionary-set-value dict "MODE" (symbol-name major-mode))
    (srecode-dictionary-set-value
     dict "SHORTMODE"
     (let* ((mode-name  (symbol-name major-mode))
	    (match (string-match "-mode" mode-name)))
       (if match
	   (substring mode-name 0 match)
	 mode-name)))
    (if (or (file-exists-p "CVS")
	    (file-exists-p "RCS"))
	(srecode-dictionary-show-section dict "RCS")
      )))