From bea3442abbe8129b3cb49ced4f360587ee0f0b36 Mon Sep 17 00:00:00 2001 From: Javier Olaechea Date: Mon, 20 Mar 2023 10:28:34 -0500 Subject: [PATCH 1/6] Silence warning about unused arguments By naming the variable with the _ prefix the compiler knows it is intended to be unused. > In browse-at-remote--format-region-url-as-gitiles: > lib/browse-at-remote/browse-at-remote.el:456:103: Warning: Unused lexical argument `lineend' --- browse-at-remote.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/browse-at-remote.el b/browse-at-remote.el index 22b1040..fed67b9 100644 --- a/browse-at-remote.el +++ b/browse-at-remote.el @@ -285,7 +285,7 @@ related remote in `browse-at-remote-remote-type-regexps'." (string-join (append domain (list "cgit" project)) "/"))) -(defun browse-at-remote--format-region-url-as-gnu (repo-url location filename &optional linestart lineend) +(defun browse-at-remote--format-region-url-as-gnu (repo-url location filename &optional linestart _lineend) "URL formatter for gnu." (let ((repo-url (browse-at-remote-gnu-format-url repo-url))) (cond @@ -334,7 +334,7 @@ related remote in `browse-at-remote-remote-type-regexps'." (linestart (format "%s&line=%d&lineStartColumn=1&lineEndColumn=1" base-url linestart)) (t base-url)))) -(defun browse-at-remote--format-commit-url-as-ado (repo-url commithash) +(defun browse-at-remote--format-commit-url-as-ado (_repo-url _commithash) "Commit URL formatted for ado" ;; They does not seem to have anything like permalinks from github. (error "The ado version of the commit-url is not implemented")) @@ -351,7 +351,7 @@ related remote in `browse-at-remote-remote-type-regexps'." "Commit URL formatted for bitbucket" (format "%s/commits/%s" repo-url commithash)) -(defun browse-at-remote--format-region-url-as-gist (repo-url location filename &optional linestart lineend) +(defun browse-at-remote--format-region-url-as-gist (repo-url _location filename &optional linestart lineend) "URL formatted for gist." (concat (format "%s#file-%s" repo-url @@ -453,7 +453,7 @@ Currently the same as for github." "\\1\\2\\3" repo-url)) -(defun browse-at-remote--format-region-url-as-gitiles (repo-url location filename &optional linestart lineend) +(defun browse-at-remote--format-region-url-as-gitiles (repo-url location filename &optional linestart _lineend) "Region URL formatted for Gitiles." (format "%s/+/%s/%s%s" (browse-at-remote--gerrit-url-cleanup repo-url) From 5deed9c943991c8156f0f8e7c97a1651bc630ddd Mon Sep 17 00:00:00 2001 From: Javier Olaechea Date: Mon, 20 Mar 2023 10:35:40 -0500 Subject: [PATCH 2/6] Ignore autoload files --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 21c089e..6e92a18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /elpa /.cask *.elc -*~ \ No newline at end of file +*~ +*-autoloads.el From a3a5b1b73b391630747f1dfdc74be84ba6a77e3e Mon Sep 17 00:00:00 2001 From: Javier Olaechea Date: Mon, 20 Mar 2023 10:42:40 -0500 Subject: [PATCH 3/6] Silence warnings about docstring being wider than 80 characters > lib/browse-at-remote/browse-at-remote.el:83:2: Warning: custom-declare-variable `browse-at-remote-preferred-remote-name' docstring wider than 80 characters > lib/browse-at-remote/browse-at-remote.el:102:2: Warning: custom-declare-variable `browse-at-remote-add-line-number-if-no-region-selected' docstring wider than 80 characters > > In browse-at-remote--get-preferred-remote: > lib/browse-at-remote/browse-at-remote.el:227:2: Warning: docstring wider than 80 characters > > In browse-at-remote--get-formatter: > lib/browse-at-remote/browse-at-remote.el:274:2: Warning: docstring wider than 80 characters --- browse-at-remote.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/browse-at-remote.el b/browse-at-remote.el index fed67b9..cb9e5b8 100644 --- a/browse-at-remote.el +++ b/browse-at-remote.el @@ -83,8 +83,8 @@ resolved to `:actual-host'." (defcustom browse-at-remote-preferred-remote-name "origin" "The preferred remote name -Remotes ares sorted alphabetically, which might return the wrong remote pointing to a different url. -When nil or not found use the first remote." +Remotes ares sorted alphabetically, which might return the wrong remote pointing +to a different url. When nil or not found use the first remote." :type 'string :group 'browse-at-remote) @@ -101,7 +101,8 @@ When nil, uses the commit hash. The contents will never change." (defcustom browse-at-remote-add-line-number-if-no-region-selected t "Always add line number even if region is not selected in buffer. -When is option is t, bar-browse adds line number to URL even if region was not selected. +When is option is t, bar-browse adds line number to URL even if region was not +selected. By default is true." :type 'boolean @@ -225,7 +226,8 @@ If HEAD is detached, return nil." (s-lines remotes))))) (defun browse-at-remote--get-preferred-remote () - "Return either the preferred remote matching the name of browse-at-remote-preferred-remote-name. + "Return either the preferred remote matching the name of +`browse-at-remote-preferred-remote-name'. If nil return the first remote in the list." (let ((remotes (browse-at-remote--get-remotes))) (if (and @@ -272,7 +274,8 @@ related remote in `browse-at-remote-remote-type-regexps'." host))) (defun browse-at-remote--get-formatter (formatter-type remote-type) - "Get formatter function for given FORMATTER-TYPE (region-url or commit-url) and REMOTE-TYPE (github or bitbucket)" + "Get formatter function for given FORMATTER-TYPE (region-url or commit-url) and +REMOTE-TYPE (github or bitbucket)" (let ((formatter (intern (format "browse-at-remote--format-%s-as-%s" formatter-type remote-type)))) (if (fboundp formatter) formatter nil))) From 87ba3d8b74ed68119d0ec97a1542e5a718d625fe Mon Sep 17 00:00:00 2001 From: Javier Olaechea Date: Mon, 20 Mar 2023 10:45:22 -0500 Subject: [PATCH 4/6] Replace SEQ-CONTAINS with SEQ-CONTAINS-P MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > In browse-at-remote--format-region-url-as-pagure: > lib/browse-at-remote/browse-at-remote.el:439:20: Warning: ‘seq-contains’ is an obsolete function (as of 27.1); use ‘seq-contains-p’ instead. --- browse-at-remote.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browse-at-remote.el b/browse-at-remote.el index cb9e5b8..aec3800 100644 --- a/browse-at-remote.el +++ b/browse-at-remote.el @@ -436,7 +436,7 @@ Currently the same as for github." (defun browse-at-remote--format-region-url-as-pagure (repo-url location filename &optional linestart lineend) (let* ((repo-url (s-replace "/forks/" "/fork/" repo-url)) (markup_ext (list ".rst" ".mk" ".md" ".markdown")) - (markup? (seq-contains (mapcar (lambda (x) (string-suffix-p x filename)) markup_ext) t)) + (markup? (seq-contains-p (mapcar (lambda (x) (string-suffix-p x filename)) markup_ext) t)) (filename (cond (markup? (concat filename "?text=True")) (t filename)))) (cond From a66f1420db7c886bfcc76d41952abd7abd787cc5 Mon Sep 17 00:00:00 2001 From: Javier Olaechea Date: Mon, 20 Mar 2023 10:49:37 -0500 Subject: [PATCH 5/6] Silence warnings about functions not known to be defined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > In end of data: > lib/browse-at-remote/browse-at-remote.el:544:42: Warning: the function ‘log-view-current-entry’ is not known to be defined. > lib/browse-at-remote/browse-at-remote.el:514:34: Warning: the function ‘dired-current-directory’ is not known to be defined. --- browse-at-remote.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/browse-at-remote.el b/browse-at-remote.el index aec3800..9c1e7ca 100644 --- a/browse-at-remote.el +++ b/browse-at-remote.el @@ -505,6 +505,8 @@ Currently the same as for github." (if start-line start-line) (if (and end-line (not (equal start-line end-line))) end-line)))) +(declare-function dired-current-directory "dired") +(declare-function log-view-current-entry "log-view") (defun browse-at-remote-get-url () "Main method, returns URL to browse." From 9eeb7fe558cb79d6ee4ebe800da8fdfe66fb9160 Mon Sep 17 00:00:00 2001 From: Javier Olaechea Date: Mon, 20 Mar 2023 10:56:15 -0500 Subject: [PATCH 6/6] Silence warning about usage of unescaped single qutoes > lib/browse-at-remote/browse-at-remote.el:375:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting) --- browse-at-remote.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browse-at-remote.el b/browse-at-remote.el index 9c1e7ca..187531d 100644 --- a/browse-at-remote.el +++ b/browse-at-remote.el @@ -373,7 +373,7 @@ REMOTE-TYPE (github or bitbucket)" (format "%s/%s" repo-url commithash)))) (defun browse-at-remote--fix-repo-url-stash (repo-url) - "Inserts 'projects' and 'repos' in #repo-url" + "Inserts `projects' and `repos' in REPO-URL" (let* ((reversed-url (reverse (split-string repo-url "/"))) (project (car reversed-url)) (repo (nth 1 reversed-url)))