From e3e168a9610c9afe02f92478b20c1a106bf19269 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Tue, 22 Jan 2019 15:43:29 +0100 Subject: [PATCH] Update clojure-mode. Signed-off-by: Andreas Gerler --- .../clojure-mode-pkg.el | 2 - .../clojure-mode-autoloads.el | 0 .../clojure-mode-pkg.el | 2 + .../clojure-mode.el | 68 +++++++++++-------- elpa/clojure-mode-readme.txt | 18 +++++ 5 files changed, 61 insertions(+), 29 deletions(-) delete mode 100644 elpa/clojure-mode-20181024.2224/clojure-mode-pkg.el rename elpa/{clojure-mode-20181024.2224 => clojure-mode-20190105.1043}/clojure-mode-autoloads.el (100%) create mode 100644 elpa/clojure-mode-20190105.1043/clojure-mode-pkg.el rename elpa/{clojure-mode-20181024.2224 => clojure-mode-20190105.1043}/clojure-mode.el (98%) create mode 100644 elpa/clojure-mode-readme.txt diff --git a/elpa/clojure-mode-20181024.2224/clojure-mode-pkg.el b/elpa/clojure-mode-20181024.2224/clojure-mode-pkg.el deleted file mode 100644 index 8efb1390..00000000 --- a/elpa/clojure-mode-20181024.2224/clojure-mode-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "clojure-mode" "20181024.2224" "Major mode for Clojure code" '((emacs "25.1")) :commit "71b32ee95e8ec99098e212cd0ec74cb4c002e8c6" :keywords '("languages" "clojure" "clojurescript" "lisp") :url "http://github.com/clojure-emacs/clojure-mode") diff --git a/elpa/clojure-mode-20181024.2224/clojure-mode-autoloads.el b/elpa/clojure-mode-20190105.1043/clojure-mode-autoloads.el similarity index 100% rename from elpa/clojure-mode-20181024.2224/clojure-mode-autoloads.el rename to elpa/clojure-mode-20190105.1043/clojure-mode-autoloads.el diff --git a/elpa/clojure-mode-20190105.1043/clojure-mode-pkg.el b/elpa/clojure-mode-20190105.1043/clojure-mode-pkg.el new file mode 100644 index 00000000..dc407398 --- /dev/null +++ b/elpa/clojure-mode-20190105.1043/clojure-mode-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "clojure-mode" "20190105.1043" "Major mode for Clojure code" '((emacs "25.1")) :commit "1ccef7b2b7a063aa42416d1518e8e7228d90a78d" :keywords '("languages" "clojure" "clojurescript" "lisp") :url "http://github.com/clojure-emacs/clojure-mode") diff --git a/elpa/clojure-mode-20181024.2224/clojure-mode.el b/elpa/clojure-mode-20190105.1043/clojure-mode.el similarity index 98% rename from elpa/clojure-mode-20181024.2224/clojure-mode.el rename to elpa/clojure-mode-20190105.1043/clojure-mode.el index 5f71f3e4..0a8db478 100644 --- a/elpa/clojure-mode-20181024.2224/clojure-mode.el +++ b/elpa/clojure-mode-20190105.1043/clojure-mode.el @@ -9,9 +9,9 @@ ;; Bozhidar Batsov ;; Artur Malabarba ;; URL: http://github.com/clojure-emacs/clojure-mode -;; Package-Version: 20181024.2224 +;; Package-Version: 20190105.1043 ;; Keywords: languages clojure clojurescript lisp -;; Version: 5.10.0-snapshot +;; Version: 5.10.0 ;; Package-Requires: ((emacs "25.1")) ;; This file is not part of GNU Emacs. @@ -70,6 +70,8 @@ (require 'newcomment) (require 'align) (require 'subr-x) +(require 'lisp-mnt) +(require 'project) (declare-function lisp-fill-paragraph "lisp-mode" (&optional justify)) @@ -80,7 +82,7 @@ :link '(url-link :tag "GitHub" "https://github.com/clojure-emacs/clojure-mode") :link '(emacs-commentary-link :tag "Commentary" "clojure-mode")) -(defconst clojure-mode-version "5.8.2" +(defconst clojure-mode-version (lm-version) "The current version of `clojure-mode'.") (defface clojure-keyword-face @@ -93,7 +95,7 @@ "Face used to font-lock Clojure character literals." :package-version '(clojure-mode . "3.0.0")) -(defcustom clojure-indent-style :always-align +(defcustom clojure-indent-style 'always-align "Indentation style to use for function forms and macro forms. There are two cases of interest configured by this variable. @@ -111,7 +113,7 @@ already use special indentation rules. The possible values for this variable are keywords indicating how to indent function forms. - `:always-align' - Follow the same rules as `lisp-mode'. All + `always-align' - Follow the same rules as `lisp-mode'. All args are vertically aligned with the first arg in case (A), and vertically aligned with the function name in case (B). For instance: @@ -121,30 +123,27 @@ to indent function forms. merge some-coll) - `:always-indent' - All args are indented like a macro body. + `always-indent' - All args are indented like a macro body. (reduce merge some-coll) (reduce merge some-coll) - `:align-arguments' - Case (A) is indented like `lisp', and + `align-arguments' - Case (A) is indented like `lisp', and case (B) is indented like a macro body. (reduce merge some-coll) (reduce merge some-coll)" - :safe #'keywordp - :type '(choice (const :tag "Same as `lisp-mode'" :always-align) - (const :tag "Indent like a macro body" :always-indent) + :safe #'symbolp + :type '(choice (const :tag "Same as `lisp-mode'" 'always-align) + (const :tag "Indent like a macro body" 'always-indent) (const :tag "Indent like a macro body unless first arg is on the same line" - :align-arguments)) + 'align-arguments)) :package-version '(clojure-mode . "5.2.0")) -(define-obsolete-variable-alias 'clojure-defun-style-default-indent - 'clojure-indent-style "5.2.0") - (defcustom clojure-use-backtracking-indent t "When non-nil, enable context sensitive indentation." :type 'boolean @@ -180,11 +179,12 @@ For example, \[ is allowed in :db/id[:db.part/user]." (cl-every 'characterp value)))) (defcustom clojure-build-tool-files - '("project.clj" ; Leiningen - "build.boot" ; Boot - "build.gradle" ; Gradle - "deps.edn" ; Clojure CLI (a.k.a. tools.deps) - "shadow-cljs.edn" ; shadow-cljs + '("project.clj" ; Leiningen + "build.boot" ; Boot + "build.gradle" ; Gradle + "build.gradle.kts" ; Gradle + "deps.edn" ; Clojure CLI (a.k.a. tools.deps) + "shadow-cljs.edn" ; shadow-cljs ) "A list of files, which identify a Clojure project's root. Out-of-the box `clojure-mode' understands lein, boot, gradle, @@ -1305,7 +1305,10 @@ symbol properties." 'clojure-indent-function) (get (intern-soft (match-string 1 function-name)) 'clojure-backtracking-indent))) - (when (string-match (rx (or "let" "when" "while") (syntax symbol)) + ;; indent symbols starting with if, when, ... + ;; such as if-let, when-let, ... + ;; like if, when, ... + (when (string-match (rx string-start (or "if" "when" "let" "while") (syntax symbol)) function-name) (clojure--get-indent-method (substring (match-string 0 function-name) 0 -1))))) @@ -1365,6 +1368,10 @@ spec." (let ((function (thing-at-point 'symbol))) (clojure--get-indent-method function)))) +(defun clojure--keyword-to-symbol (keyword) + "Convert KEYWORD to symbol." + (intern (substring (symbol-name keyword) 1))) + (defun clojure--normal-indent (last-sexp indent-mode) "Return the normal indentation column for a sexp. Point should be after the open paren of the _enclosing_ sexp, and @@ -1390,19 +1397,22 @@ accepted by `clojure-indent-style'." ;; Here we have reached the start of the enclosing sexp (point is now at ;; the function name), so the behaviour depends on INDENT-MODE and on ;; whether there's also an argument on this line (case A or B). - (let ((case-a ; The meaning of case-a is explained in `clojure-indent-style'. + (let ((indent-mode (if (keywordp indent-mode) + ;; needed for backwards compatibility + ;; as before clojure-mode 5.10 indent-mode was a keyword + (clojure--keyword-to-symbol indent-mode) + indent-mode)) + (case-a ; The meaning of case-a is explained in `clojure-indent-style'. (and last-sexp-start (< last-sexp-start (line-end-position))))) (cond - ;; For compatibility with the old `clojure-defun-style-default-indent', any - ;; value other than these 3 is equivalent to `always-body'. - ((not (memq indent-mode '(:always-align :align-arguments nil))) + ((eq indent-mode 'always-indent) (+ (current-column) lisp-body-indent -1)) ;; There's an arg after the function name, so align with it. (case-a (goto-char last-sexp-start) (current-column)) ;; Not same line. - ((eq indent-mode :align-arguments) + ((eq indent-mode 'align-arguments) (+ (current-column) lisp-body-indent -1)) ;; Finally, just align with the function name. (t (current-column))))))) @@ -1474,7 +1484,7 @@ This function also returns nil meaning don't specify the indentation." (+ lisp-body-indent containing-form-column)) ;; Further non-special args, align with the arg above. ((> pos (1+ method)) - (clojure--normal-indent last-sexp :always-align)) + (clojure--normal-indent last-sexp 'always-align)) ;; Special arg. Rigidly indent with a large indentation. (t (+ (* 2 lisp-body-indent) containing-form-column))))) @@ -1488,7 +1498,7 @@ This function also returns nil meaning don't specify the indentation." (cond ;; Preserve useful alignment of :require (and friends) in `ns' forms. ((and function (string-match "^:" function)) - (clojure--normal-indent last-sexp :always-align)) + (clojure--normal-indent last-sexp 'always-align)) ;; This should be identical to the :defn above. ((and function (string-match "\\`\\(?:\\S +/\\)?\\(def[a-z]*\\|with-\\)" @@ -1718,6 +1728,10 @@ Return nil if not inside a project." (when (> (length choices) 0) (car (sort choices #'file-in-directory-p))))) +;; project.el integration +(cl-defmethod project-roots ((project (head clojure))) + (list (cdr project))) + (defun clojure-project-relative-path (path) "Denormalize PATH by making it relative to the project root." (file-relative-name path (clojure-project-dir))) diff --git a/elpa/clojure-mode-readme.txt b/elpa/clojure-mode-readme.txt new file mode 100644 index 00000000..1f61cfb7 --- /dev/null +++ b/elpa/clojure-mode-readme.txt @@ -0,0 +1,18 @@ +Provides font-lock, indentation, navigation and basic refactoring for the +Clojure programming language (http://clojure.org). + +Using clojure-mode with paredit or smartparens is highly recommended. + +Here are some example configurations: + + ;; require or autoload paredit-mode + (add-hook 'clojure-mode-hook #'paredit-mode) + + ;; require or autoload smartparens + (add-hook 'clojure-mode-hook #'smartparens-strict-mode) + +See inf-clojure (http://github.com/clojure-emacs/inf-clojure) for +basic interaction with Clojure subprocesses. + +See CIDER (http://github.com/clojure-emacs/cider) for +better interaction with subprocesses via nREPL. -- 2.47.3