fsfe / reuse-tool

reuse is a tool for compliance with the REUSE recommendations.
https://reuse.software
399 stars 148 forks source link

Preserve first comment indentation #919

Open monacofj opened 8 months ago

monacofj commented 8 months ago

This is minor change that I needed to serve my particular demands; sharing it in the event it's of use:

preserve the indentation of the first comment.

TL;DR;

Some editors (e.g. Emacs) use to automatically indent comments in assembly code, like

          ;; Do something

          mov $42, %eax
          ret

          ;; Do something else

          sub $1, %eax
          ret

Currently, reuse annotate would render the output like this

;;; SPDX-FileCopyrightText: 2024 Author
;;;
;;; SPDX-License-Identifier: CCO

;; Do something

          mov $42, %eax
          ret

         ;; Do something else

          sub $1, %eax
          ret

The suggested change should preserve the original indentation of the first paragraph:

;;; SPDX-FileCopyrightText: 2024 Author
;;;
;;; SPDX-License-Identifier: CCO

        ;; Do something

          mov $42, %eax
          ret

         ;; Do something else

          sub $1, %eax
          ret
monacofj commented 8 months ago

Tentative fix in PR #920.