I'm trying to write an elisp program that will insert a section header and footer as a comment. For example, if I need a section called "intro" for my LaTeX document, the following would be inserted:
%----------BEGIN INTRO----------%
%-----------END INTRO-----------%
Similarly, if I need a section called "functions" in my C++ file, the following would be inserted:
//----------BEGIN FUNCTIONS----------//
//----------END FUNCTIONS-----------//
My trouble is finding a way to identify the comment pattern of the current major mode so that it can be included in the inserted string. Any insight would be appreciated.
comment-dwim
command. My plan was to try to figure out howcomment-dwim
knew what the comment character was in order to make its comment, but that didn't work out. Additionally, I couldn't find anything helpful via the syntax table route. I saw a bunch of stuff for making a syntax table, but nothing on how to extract the comment sequence from it. – Voytella Jan 16 '18 at 14:46