       (delete-region start (point)))))
 
 (defun p2l-remove-footer ()
+  "Remove the useless end of the file."
   (interactive)
   (goto-char (point-max))
   (let ((end (point)))

  '("clsindexmain" "needlines"))

(defun p2l--setup-buffer ()
  (goto-char (point-min))
  (fundamental-mode)
  (font-lock-mode -1))

(defun p2l-remove-latex-comments ()
  (interactive)
  (p2l--setup-buffer)
  (delete-matching-lines "^%.*$"))

(defun p2l-remove-useless-macros ()
  (interactive)
  (p2l--setup-buffer)
  (while (re-search-forward
          (concat "\\\\"
                  (regexp-opt 
                   (append p2l-editor-macros
                           p2l-misc-macros-to-remove))
                  "{")

              (delete-forward-char 1) ;; [
              (p2l--delete-all-spaces)
              (re-search-forward "]")
              (delete-char -1) ;; ]
              (p2l--delete-all-spaces)
              (newline 1)
              (insert ":")))
