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

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

insert-header-preprocessor-definition


From: Emanuel Berg
Subject: insert-header-preprocessor-definition
Date: Wed, 11 Apr 2018 07:36:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

(defun insert-header-preprocessor-definition ()
  (interactive)
  (let*((filename (buffer-name))
        (label (upcase (replace-regexp-in-string "\\." "_" filename)))
        (beg-string (concat
                     (format "#ifndef %s\n"   label)
                     (format "#define %s\n\n" label) ))
        (end-string "\n#endif") )
    (save-excursion
      (goto-char (point-min))
      (insert beg-string)

      (goto-char (point-max))
      (beginning-of-line)
      (insert end-string) )
    ))
(defalias 'hep #'insert-header-preprocessor-definition)

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


reply via email to

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