[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: insert-header-preprocessor-definition
From: |
Emanuel Berg |
Subject: |
Re: insert-header-preprocessor-definition |
Date: |
Thu, 12 Apr 2018 00:07:49 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Ben Bacarisse wrote:
>> So for color.c, color.h should have
>> H_COLOR_H?
>
> That is safe, yes. Doing it by hand, I think
> most people write H_COLOR but you can't even
> be sure there will be a .h in the name!
(defun insert-header-preprocessor-definition ()
(interactive)
(let*((filename (buffer-name))
(label (upcase (replace-regexp-in-string "\\." "_" filename)))
(safe-label (concat "H_" label))
(beg-string (concat
"#ifndef " safe-label "\n"
"#define " safe-label "\n\n"))
(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)
http://user.it.uu.se/~embe8573/emacs-init/ide/c-and-cpp.el
--
underground experts united
http://user.it.uu.se/~embe8573
- insert-header-preprocessor-definition, Emanuel Berg, 2018/04/11
- Re: insert-header-preprocessor-definition, Ben Bacarisse, 2018/04/11
- Re: insert-header-preprocessor-definition, Emanuel Berg, 2018/04/11
- Re: insert-header-preprocessor-definition, Ben Bacarisse, 2018/04/11
- Re: insert-header-preprocessor-definition,
Emanuel Berg <=
- Re: insert-header-preprocessor-definition, Emanuel Berg, 2018/04/14
- Re: insert-header-preprocessor-definition, Ben Bacarisse, 2018/04/14
- Re: insert-header-preprocessor-definition, Yuri Khan, 2018/04/15
- Re: insert-header-preprocessor-definition, Emanuel Berg, 2018/04/15
- Re: insert-header-preprocessor-definition, Ben Bacarisse, 2018/04/15
- Re: insert-header-preprocessor-definition, Emanuel Berg, 2018/04/15
- Message not available
- Re: insert-header-preprocessor-definition, Emanuel Berg, 2018/04/15
- Re: insert-header-preprocessor-definition, Yuri Khan, 2018/04/16
- Message not available
- Re: insert-header-preprocessor-definition, Emanuel Berg, 2018/04/16