emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/shellcop 4e71f5b919: compile is part of CI


From: ELPA Syncer
Subject: [nongnu] elpa/shellcop 4e71f5b919: compile is part of CI
Date: Thu, 26 May 2022 10:58:55 -0400 (EDT)

branch: elpa/shellcop
commit 4e71f5b9199a0ad10017104a6b2bf5ef5f207dfc
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>

    compile is part of CI
---
 .github/workflows/test.yml | 26 ++++++++++++++++++++++++++
 Makefile                   | 20 ++++++++++++++++++++
 README.org                 |  1 +
 shellcop.el                | 16 ++++++++--------
 tests/my-byte-compile.el   | 44 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 99 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000000..a3dbc99b95
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,26 @@
+name: CI
+
+on: [push, pull_request]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        emacs_version:
+          - 25.3
+          - 26.3
+          - 27.1
+    steps:
+    - uses: purcell/setup-emacs@master
+      with:
+        version: ${{ matrix.emacs_version }}
+
+    - uses: actions/checkout@v2
+
+    - name: Print emacs version
+      run: emacs --version
+
+    - name: Run tests
+      run: make test
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..a0380adace
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,20 @@
+# -*- Makefile -*-
+SHELL = /bin/sh
+EMACS ?= emacs
+
+.PHONY: deps clean test compile
+
+EMACS_BATCH_OPTS=--batch -Q -l shellcop.el
+
+RM = @rm -rf
+
+clean:
+       $(RM) *~
+       $(RM) \#*\#
+       $(RM) *.elc
+
+compile: clean
+       @$(EMACS) $(EMACS_BATCH_OPTS) -l tests/my-byte-compile.el 2>&1 | grep 
-E "([Ee]rror|[Ww]arning):" && exit 1 || exit 0
+
+test: compile
+       @echo "Test is done"
diff --git a/README.org b/README.org
index 4218e6aa9f..8bae581452 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,5 @@
 * shellcop
+[[https://github.com/redguardtoo/shellcop/actions/workflows/test.yml][https://github.com/redguardtoo/shellcop/actions/workflows/test.yml/badge.svg]]
 
[[https://elpa.nongnu.org/nongnu/shellcop.html][file:https://elpa.nongnu.org/nongnu/shellcop.svg]]
 
[[http://melpa.org/#/shellcop][file:http://melpa.org/packages/shellcop-badge.svg]]
 
[[http://stable.melpa.org/#/shellcop][file:http://stable.melpa.org/packages/shellcop-badge.svg]]
diff --git a/shellcop.el b/shellcop.el
index 5baed20d64..39d3214931 100644
--- a/shellcop.el
+++ b/shellcop.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2020-2021 Chen Bin
 ;;
-;; Version: 0.0.9
+;; Version: 0.1.0
 ;; Keywords: unix tools
 ;; Author: Chen Bin <chenbin.sh@gmail.com>
 ;; URL: https://github.com/redguardtoo/shellcop
@@ -59,6 +59,7 @@
 
 (require 'cl-lib)
 (require 'comint)
+(require 'subr-x)
 
 (defgroup shellcop nil
   "Analyze errors reported in Emacs builtin shell."
@@ -97,7 +98,7 @@ If there is error, it returns t."
   :group 'shellcop)
 
 (defcustom shellcop-string-search-function 'search-backward
-  "The string search function used in 
`shellcop-search-in-shell-buffer-of-other-window'."
+  "String search function for 
`shellcop-search-in-shell-buffer-of-other-window'."
   :type 'function
   :group 'shellcop)
 
@@ -154,7 +155,8 @@ If there is error, it returns t."
 
 (defun shellcop-extract-locations-at-point (&optional above)
   "Extract locations in one direction into RLT.
-If ABOVE is t, extract locations above current point; or else below current 
point."
+If ABOVE is t, extract locations above current point,
+If ABOVE is nil, extract locations below current point."
 (let* (rlt
        (line (if above -1 1))
        location)
@@ -212,8 +214,7 @@ If ABOVE is t, extract locations above current point; or 
else below current poin
 (defun shellcop-comint-send-input-hack (orig-func &rest args)
   "Advice `comint-send-input' with ORIG-FUNC and ARGS.
 Extract file paths when user presses enter key shell."
-  (let* ((artifical (nth 1 args))
-         locations)
+  (let* ((artifical (nth 1 args)))
     (when shellcop-debug
       (message "shellcop-comint-send-input-hack (%s)" artifical))
     (cond
@@ -421,8 +422,7 @@ Or else, the directory is opened in `dired-mode'."
     ;; Emacs use gzip to extract plain text file "~/.z"
     (let* ((dirs (shellcop-directories-from-z))
            dest
-           pattern
-           shell-window)
+           pattern)
 
       (when (> (length dirs) 0)
         (setq pattern
@@ -444,7 +444,7 @@ Or else, the directory is opened in `dired-mode'."
             (insert "cd " dest))
 
            ;; jump to the shell
-           ((setq shell-window (shellcop-get-window 
shellcop-shell-buffer-name))
+           ((shellcop-get-window shellcop-shell-buffer-name)
             (shellcop-focus-window shellcop-shell-buffer-name
                                    (lambda (keyword)
                                      (ignore keyword)
diff --git a/tests/my-byte-compile.el b/tests/my-byte-compile.el
new file mode 100644
index 0000000000..85aa3617ef
--- /dev/null
+++ b/tests/my-byte-compile.el
@@ -0,0 +1,44 @@
+;;; 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 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 (member dir '("." ".." ".git" ".svn" "deps" "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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]