Skip to content

Instantly share code, notes, and snippets.

@autosquid
Created March 16, 2018 15:46
Show Gist options
  • Save autosquid/d72e2e846b0692046563ee73d547a580 to your computer and use it in GitHub Desktop.
Save autosquid/d72e2e846b0692046563ee73d547a580 to your computer and use it in GitHub Desktop.
remove cpp header guard (once)
(defun remove-line()
(delete-region
(progn (forward-visible-line 0) (point))
(progn (forward-visible-line 1) (point))))
(defun remove-guard()
(interactive)
(progn
(goto-char (point-min))
(search-forward-regexp "^#ifndef")
(remove-line)
(goto-char (point-min))
(search-forward-regexp "^#define")
(remove-line )
(goto-char (point-max))
(search-backward-regexp "^#endif")
(remove-line)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment