[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auto-header 5195004da5 15/26: Skip a potential comment
From: |
ELPA Syncer |
Subject: |
[elpa] externals/auto-header 5195004da5 15/26: Skip a potential comment at the beginning of a file |
Date: |
Sun, 26 Mar 2023 07:57:35 -0400 (EDT) |
branch: externals/auto-header
commit 5195004da54e885b73a52ac1d91e2531e57fad62
Author: Philip Kaludercic <philip.kaludercic@fau.de>
Commit: Philip Kaludercic <philip.kaludercic@fau.de>
Skip a potential comment at the beginning of a file
---
auto-header.el | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/auto-header.el b/auto-header.el
index 24add178ca..c6e9fa00cd 100644
--- a/auto-header.el
+++ b/auto-header.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2022 Philip Kaludercic
;; Author: Philip Kaludercic <philip.kaludercic@fau.de>
-;; Version: $Id: auto-header.el,v 1.11 2022/05/16 08:32:02 oj14ozun Exp
oj14ozun $
+;; Version: $Id: auto-header.el,v 1.11 2022/05/16 08:32:02 oj14ozun Exp $
;; URL: https://wwwcip.cs.fau.de/~oj14ozun/src+etc/auto-header.el
;; Package-Version: 1
;; Keywords: c
@@ -85,24 +85,24 @@
(widen)
(save-excursion
(goto-char (point-min))
+ (when (forward-comment 1)
+ (search-forward-regexp "^.+$" nil t)
+ (forward-paragraph))
(dolist (header headers)
- (insert "#include <" header ">")
- (newline))
+ (insert "#include <" header ">")
+ (newline))
(goto-char (point-max))
(when (search-backward-regexp "#include ?<" nil t)
- (save-restriction
- (narrow-to-region (point-min) (line-end-position))
- (delete-duplicate-lines (point-min) (point-max) nil nil t)
- (sort-lines nil (point-min) (point-max))
- (goto-char (point-max))
- (newline))
- (delete-blank-lines))
- (newline))))
-
-(defun auto-header-insert (header)
- "Add HEADER to the top of the file."
- (interactive "MAdd header: ")
- (auto-header--insert-headers (list header)))
+ (save-restriction
+ (let ((end (line-end-position)))
+ (goto-char (point-min))
+ (forward-comment 1)
+ (narrow-to-region (point) end)
+ (delete-duplicate-lines (point-min) (point-max) nil nil t)
+ (sort-lines nil (point-min) (point-max)))
+ (goto-char (point-max))
+ (newline))
+ (delete-blank-lines)))))
;;;###autoload
(defun auto-header-at-point (name)
- [elpa] branch externals/auto-header created (now 2681884766), ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header 408aab1dec 06/26: Ignore symbols in strings, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header 0e34d101b9 11/26: Add URL header, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header ac0f359102 01/26: Initial revision, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header 44151ef2ce 04/26: Add autoload cookies where useful, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header 84d6072729 13/26: Use a $Revision$ string for version, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header 5195004da5 15/26: Skip a potential comment at the beginning of a file,
ELPA Syncer <=
- [elpa] externals/auto-header a77ba1fed7 16/26: Readd auto-header-insert, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header c9eda61104 20/26: Update headers after RCS export, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header f29a1a45fe 02/26: Add auto-header-mode as a minor mode, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header 437ba6a407 07/26: Run untabify, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header 49634257f4 03/26: Document auto-header-mode, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header dece50cc3e 05/26: Avoid generating cyclic lists, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header 68909a22d3 10/26: Abbreviate Package-Version, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header 4cd6c76318 12/26: Add auto-header-insert command, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header bc966c2d8b 22/26: Add a .gitignore, ELPA Syncer, 2023/03/26
- [elpa] externals/auto-header 25b62deb83 24/26: Add a basic README file, ELPA Syncer, 2023/03/26