[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-nerd-commenter 73b230073e 1/3: fixed warnings from na
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-nerd-commenter 73b230073e 1/3: fixed warnings from native compiler |
Date: |
Sun, 29 May 2022 23:58:18 -0400 (EDT) |
branch: elpa/evil-nerd-commenter
commit 73b230073e4535391c6c6be499d2dc45a39f91c2
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
fixed warnings from native compiler
---
Makefile | 31 +++++++++++++++++++++--------
evil-nerd-commenter-sdk.el | 1 +
evil-nerd-commenter.el | 13 +++++++-----
tests/my-byte-compile.el | 49 ++++++++++++++++++++++++++++++++++++++++++++++
tests/my-elint.el | 34 ++++++++++++++++++++++++++++++++
5 files changed, 115 insertions(+), 13 deletions(-)
diff --git a/Makefile b/Makefile
index 52325eba2a..b5ad514a53 100644
--- a/Makefile
+++ b/Makefile
@@ -2,20 +2,35 @@ SHELL = /bin/sh
EMACS ?= emacs
PROFILER =
-.PHONY: test deps
+.PHONY: test deps clean
+RM= @rm -rf
+EMACS_BATCH_OPTS=--batch -Q \
+-L . \
+-L deps/ \
+-L deps/evil-1.14.2 \
+-l deps/web-mode.el \
+-l evil-nerd-commenter-sdk.el \
+-l evil-nerd-commenter.el
# Delete byte-compiled files etc.
clean:
- @rm -f *~
- @rm -f \#*\#
- @rm -rf deps/
- @rm -f *.elc
+ $(RM) *~
+ $(RM) \#*\#
+ $(RM) deps/*
+ $(RM) *.elc
deps:
@mkdir -p deps;
- @if [ ! -f deps/evil-1.14.0/evil.el ]; then curl -L
https://stable.melpa.org/packages/evil-1.14.0.tar | tar x -C deps/; fi;
+ @if [ ! -f deps/evil-1.14.2/evil.el ]; then curl -L
https://stable.melpa.org/packages/evil-1.14.2.tar | tar x -C deps/; fi;
@if [ ! -f deps/web-mode.el ]; then curl -L
https://raw.githubusercontent.com/fxbois/web-mode/master/web-mode.el >
deps/web-mode.el; fi;
+lint: deps
+ @$(EMACS) ${EMACS_BATCH_OPTS} -l tests/my-elint.el 2>&1 | grep -E
"([Ee]rror|[Ww]arning):" && exit 1 || exit 0
+
+compile: deps
+ $(RM) *.elc
+ @$(EMACS) ${EMACS_BATCH_OPTS} -l tests/my-byte-compile.el 2>&1 | grep
-E "([Ee]rror|[Ww]arning):" && exit 1 || exit 0
+
# Run tests.
-test: deps
- $(EMACS) -batch -Q -L . -L deps/ -L deps/evil-1.14.0 -l
deps/web-mode.el -l evil-nerd-commenter-sdk.el -l evil-nerd-commenter.el -l
tests/evil-nerd-commenter-tests.el
+test: compile deps
+ $(EMACS) $(EMACS_BATCH_OPTS) -l tests/evil-nerd-commenter-tests.el
diff --git a/evil-nerd-commenter-sdk.el b/evil-nerd-commenter-sdk.el
index e8baf15df3..fb251e94c3 100644
--- a/evil-nerd-commenter-sdk.el
+++ b/evil-nerd-commenter-sdk.el
@@ -25,6 +25,7 @@
;;; Code:
+(require 'evil nil t)
(defvar evil-state)
(defun evilnc--check-fonts (fonts-under-cursor fonts-list)
diff --git a/evil-nerd-commenter.el b/evil-nerd-commenter.el
index 4e1193ae9f..db409257f7 100644
--- a/evil-nerd-commenter.el
+++ b/evil-nerd-commenter.el
@@ -370,6 +370,7 @@ See
http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-03/msg00891.html."
(defvar org-src-lang-modes)
(declare-function org-show-subtree "org")
(declare-function outline-up-heading "outline")
+(declare-function org-element-property "org-element")
(defun evilnc--org-src-block-info ()
"Return src-block info in org. It's like (start end language)."
@@ -386,7 +387,7 @@ See
http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-03/msg00891.html."
(let* ((elem (org-element-at-point))
(b (org-element-property :begin elem))
(e (org-element-property :end elem))
- (lang (org-element-property :language (org-element-at-point)))
+ (lang (org-element-property :language elem))
(str (buffer-substring-no-properties b e))
(case-fold-search t))
(when (string-match ".\+BEGIN_SRC .*$" str)
@@ -453,6 +454,8 @@ Code snippets embedded in Org-mode is identified and right
`major-mode' is used.
(funcall fn start end)))))))
(declare-function web-mode-comment-or-uncomment "ext:web-mode")
+(declare-function web-mode-uncomment-erb-block "ext:web-mode")
+(declare-function web-mode-comment-erb-block "ext:web-mode")
(defvar web-mode-engine)
(defun evilnc--warn-on-web-mode (is-comment)
@@ -579,14 +582,14 @@ Paragraphs are separated by empty lines."
num))
;;;###autoload
-(defun evilnc-comment-or-uncomment-to-the-line (&optional LINENUM)
- "Comment or uncomment from current line to LINENUM line."
+(defun evilnc-comment-or-uncomment-to-the-line (&optional line-num)
+ "Comment or uncomment from current line to LINE-NUM line."
(interactive "nLine: ")
(if (not (region-active-p))
(let* ((b (line-beginning-position))
(e (line-end-position)))
(save-excursion
- (evilnc--goto-line LINENUM)
+ (evilnc--goto-line line-num)
(if (< (line-beginning-position) b)
(setq b (line-beginning-position)))
(if (> (line-end-position) e)
@@ -676,7 +679,7 @@ CORRECT comment syntax will be used for
C++/Java/Javascript."
(evilnc-comment-or-uncomment-region b e))
num))
- (goto-line (car orig-pos))
+ (evilnc--goto-line (car orig-pos))
;; make sure we stay on original line
(goto-char (min (+ (line-beginning-position) (cdr orig-pos))
(1- (line-end-position))))))))
diff --git a/tests/my-byte-compile.el b/tests/my-byte-compile.el
new file mode 100644
index 0000000000..18396b0b2c
--- /dev/null
+++ b/tests/my-byte-compile.el
@@ -0,0 +1,49 @@
+;;; my-elint.el --- syntax check the code -*- lexical-binding: t -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+;;
+;; Author: Chen Bin <chenbin.sh@gmail.com>
+;; URL: https://github.com/tumashu/pyim
+
+;; This file is NOT part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;; Syntax check the pyim code. It's used in Emacs cli.
+;;
+
+;;; Code:
+
+(require 'find-lisp)
+
+(let ((files (find-lisp-find-files-internal
+ "."
+ (lambda (file dir)
+ (and (not (file-directory-p (expand-file-name file dir)))
+ (string-match "\\.el$" file)
+ (not (string-match "\\.dir-locals\\.el" file))))
+ (lambda (dir parent)
+ (not (or (string= dir ".")
+ (string= dir "..")
+ (string= dir ".git")
+ (string= dir ".svn")
+ (string= dir "deps")
+ (string= dir "tests")
+ (file-symlink-p (expand-file-name dir parent))))))))
+ (dolist (file files)
+ (byte-compile-file file)))
+
+(provide 'my-byte-compile)
+;;; my-elint.el ends here
diff --git a/tests/my-elint.el b/tests/my-elint.el
new file mode 100644
index 0000000000..4b5d906378
--- /dev/null
+++ b/tests/my-elint.el
@@ -0,0 +1,34 @@
+;;; my-elint.el --- syntax check the code -*- lexical-binding: t -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+;;
+;; Author: Chen Bin <chenbin.sh@gmail.com>
+;; URL: https://github.com/tumashu/pyim
+
+;; This file is NOT part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;; Syntax check the pyim code. It's used in Emacs cli.
+;;
+
+;;; Code:
+(require 'elint)
+
+(let ((elint-directory-skip-re
"\\(\\.dir-locals\\|ldefs-boot\\|loaddefs\\)\\.el\\'"))
+ (elint-directory "."))
+
+(provide 'my-elint)
+;;; my-elint.el ends here