Always use Emacs to write c ++Program, Sometimes switch between. cpp and. H files. The followingCodeThis function can be implemented (bound to F11) and added. in the emacs file, it is depressing that during debugging, because the regular expression is useless for too long, forget ". "The symbol has a special meaning without an escape character. It takes a lot of time to check the error :-(. there are also. c ++ source code file (such as boost) ending with HPP, which can be modified if necessary
; Defines the function to switch between the CPP file and the. h file.
; ;#### Autoload
(Defun switch-source-file ()
(Interactive)
(Setq file-Name (buffer-file-name ))
(If (string-match "//. cpp" file-name)
(Find-file (replace-Regexp-in-string "//. cpp" "/. H" file-name )))
(If (string-match "//. H" file-name)
(Find-file (replace-Regexp-in-string "//. H" "/. cpp" file-name ))))
^ L
(Global-set-Key [F11] 'Switch-source-file)