Skip to content

Commit

Permalink
refactor: silent byte-compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyinz committed Dec 26, 2023
1 parent c5b107d commit 2e56072
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions git-cliff.el
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ to DIR. If REGEXP is non-nil, match configurations by REGEXP instead of

(defun git-cliff--presets ()
"Return a list of git-cliff config presets."
(or git-cliff-presets
(setq git-cliff-presets (git-cliff--extract "\\.\\(to\\|ya\\)ml\\'"))))
(with-memoization git-cliff-presets
(git-cliff--extract "\\.\\(to\\|ya\\)ml\\'")))

(defun git-cliff--templates ()
"Return a list of git-cliff body templates."
(or git-cliff-templates
(setq git-cliff-templates (git-cliff--extract "\\.tera\\'"))))
(with-memoization git-cliff-templates
(git-cliff--extract "\\.tera\\'")))

;; SEE https://emacs.stackexchange.com/a/8177/35676
(defun git-cliff--completion-table (type)
Expand Down Expand Up @@ -303,21 +303,21 @@ to DIR. If REGEXP is non-nil, match configurations by REGEXP instead of
(if is-json "json" "md"))))
(unless cmd (user-error "Cannot find git-cliff in PATH"))
(when-let* ((template (git-cliff--get-infix "--body=")))
(cl-nsubstitute
(concat "--body="
(shell-quote-argument
;; NOTE replace new line
(replace-regexp-in-string
"\\\\n" "\n"
;; NOTE replace line continuation
(replace-regexp-in-string
"\\\\\n\s*" ""
(with-temp-buffer
(insert-file-contents-literally template)
(buffer-string))
nil t)
nil t)))
(concat "--body=" template) args :test #'string-equal))
(setq args (cl-substitute
(concat "--body="
(shell-quote-argument
;; NOTE replace new line
(replace-regexp-in-string
"\\\\n" "\n"
;; NOTE replace line continuation
(replace-regexp-in-string
"\\\\\n\s*" ""
(with-temp-buffer
(insert-file-contents-literally template)
(buffer-string))
nil t)
nil t)))
(concat "--body=" template) args :test #'string-equal)))
(when (zerop (shell-command (format "%s %s" cmd (string-join args " "))))
(if-let ((file (or (and is-init "cliff.toml")
(or (git-cliff--get-infix "--output=")
Expand All @@ -344,7 +344,7 @@ This command will commit all staged files by default."
"Release: %s")
tag))
tag)))
(git-cliff--open-changelog)))
(call-interactively #'git-cliff--open-changelog)))
(message "%s not prepared yet." file))))

(transient-define-suffix git-cliff--choose-preset ()
Expand Down

0 comments on commit 2e56072

Please sign in to comment.