From 195c0f72ee9798b0d94888d83b3d98dfcf7461a3 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Tue, 19 Apr 2022 10:40:49 +0200 Subject: [PATCH] upgrade clomacs Signed-off-by: Andreas Gerler --- elpa/clomacs-20191201.200/clomacs-pkg.el | 2 - .../clomacs-autoloads.el | 4 +- elpa/clomacs-20220415.1035/clomacs-pkg.el | 2 + .../clomacs.el | 190 ++++++++++-------- 4 files changed, 111 insertions(+), 87 deletions(-) delete mode 100644 elpa/clomacs-20191201.200/clomacs-pkg.el rename elpa/{clomacs-20191201.200 => clomacs-20220415.1035}/clomacs-autoloads.el (93%) create mode 100644 elpa/clomacs-20220415.1035/clomacs-pkg.el rename elpa/{clomacs-20191201.200 => clomacs-20220415.1035}/clomacs.el (83%) diff --git a/elpa/clomacs-20191201.200/clomacs-pkg.el b/elpa/clomacs-20191201.200/clomacs-pkg.el deleted file mode 100644 index 708ce383..00000000 --- a/elpa/clomacs-20191201.200/clomacs-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "clomacs" "20191201.200" "Simplifies Emacs Lisp interaction with Clojure." '((emacs "24.3") (cider "0.22.1") (s "1.12.0") (simple-httpd "1.4.6")) :commit "88b8fc6d1b7105adae009578ef24fedaf157f341" :keywords '("clojure" "interaction") :authors '(("Kostafey" . "kostafey@gmail.com")) :maintainer '("Kostafey" . "kostafey@gmail.com") :url "https://github.com/clojure-emacs/clomacs") diff --git a/elpa/clomacs-20191201.200/clomacs-autoloads.el b/elpa/clomacs-20220415.1035/clomacs-autoloads.el similarity index 93% rename from elpa/clomacs-20191201.200/clomacs-autoloads.el rename to elpa/clomacs-20220415.1035/clomacs-autoloads.el index f13f0f6c..9012e1ee 100644 --- a/elpa/clomacs-20191201.200/clomacs-autoloads.el +++ b/elpa/clomacs-20220415.1035/clomacs-autoloads.el @@ -1,4 +1,4 @@ -;;; clomacs-autoloads.el --- automatically extracted autoloads +;;; clomacs-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- ;; ;;; Code: @@ -40,7 +40,7 @@ evaluation can be added and executed. \(fn EL-FUNC-NAME CL-FUNC-NAME &key (CALL-TYPE :sync) (CALLBACK nil) (DOC nil) (INTERACTIVE nil) (RETURN-TYPE :string) (RETURN-VALUE :value) LIB-NAME NAMESPACE (HTTPD-STARTER nil) NREPL-READY-CALLBACK (BACKEND :clj))" nil t) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "clomacs" '("clo" "execute"))) +(register-definition-prefixes "clomacs" '("clomacs-" "execute")) ;;;*** diff --git a/elpa/clomacs-20220415.1035/clomacs-pkg.el b/elpa/clomacs-20220415.1035/clomacs-pkg.el new file mode 100644 index 00000000..107325f8 --- /dev/null +++ b/elpa/clomacs-20220415.1035/clomacs-pkg.el @@ -0,0 +1,2 @@ +;;; Generated package description from clomacs.el -*- no-byte-compile: t -*- +(define-package "clomacs" "20220415.1035" "Simplifies Emacs Lisp interaction with Clojure." '((emacs "24.3") (cider "0.22.1") (s "1.12.0") (simple-httpd "1.4.6") (dash "2.19.1")) :commit "9cd7c9fd86bc7bc627a31275d1ef131378b90a49" :authors '(("Kostafey" . "kostafey@gmail.com")) :maintainer '("Kostafey" . "kostafey@gmail.com") :keywords '("clojure" "interaction") :url "https://github.com/clojure-emacs/clomacs") diff --git a/elpa/clomacs-20191201.200/clomacs.el b/elpa/clomacs-20220415.1035/clomacs.el similarity index 83% rename from elpa/clomacs-20191201.200/clomacs.el rename to elpa/clomacs-20220415.1035/clomacs.el index 5c0d309c..e4b96e3a 100644 --- a/elpa/clomacs-20191201.200/clomacs.el +++ b/elpa/clomacs-20220415.1035/clomacs.el @@ -1,13 +1,14 @@ ;;; clomacs.el --- Simplifies Emacs Lisp interaction with Clojure. -*- lexical-binding: t -*- -;; Copyright (C) 2013-2019 Kostafey +;; Copyright (C) 2013-2020 Kostafey ;; Author: Kostafey ;; URL: https://github.com/clojure-emacs/clomacs -;; Package-Version: 20191201.200 +;; Package-Version: 20220415.1035 +;; Package-Commit: 9cd7c9fd86bc7bc627a31275d1ef131378b90a49 ;; Keywords: clojure, interaction -;; Version: 0.0.4 -;; Package-Requires: ((emacs "24.3") (cider "0.22.1") (s "1.12.0") (simple-httpd "1.4.6")) +;; Version: 0.0.5 +;; Package-Requires: ((emacs "24.3") (cider "0.22.1") (s "1.12.0") (simple-httpd "1.4.6") (dash "2.19.1")) ;; This file is not part of GNU Emacs. @@ -36,11 +37,14 @@ (require 'cl-lib) +(require 'find-func) (require 'net-utils) +(require 'sesman) (require 'cider) (require 'clojure-mode) (require 's) (require 'simple-httpd) +(require 'dash) (defcustom clomacs-auto-start-nrepl t "When t starts nREPL if Clojure wrapped function is called without nREPL." @@ -57,50 +61,66 @@ :group 'clomacs :type 'integer) -(defcustom clomacs-print-length 100000 - "Value for *print-length* set during `clomacs-defun' macros evaluation. +(eval-and-compile + (defcustom clomacs-print-length 100000 + "Value for *print-length* set during `clomacs-defun' macros evaluation. Restricts list length passed from Clojure to Emacs lisp. Set `nil' for unlimited list length." + :group 'clomacs + :type 'integer)) + +(defcustom clomacs-allow-other-repl nil + "When t allow use any CIDER nREPL not only library dedicated nREPL. +`nil' by default." :group 'clomacs - :type 'integer) + :type 'boolean) -(defun cloamcs-get-dir (repl-info) +(defun clomacs-get-dir (repl-info) (if repl-info (file-name-nondirectory (car (split-string repl-info ":"))))) -(defun clomacs-search-connection (project-name) - "Search nREPL connection buffer. +(eval-and-compile + (defun clomacs-search-connection (project-name) + "Search nREPL connection buffer. E.g. if you want to find \"*cider-repl clomacs-20160419.258*\" you shold pass REPL-BUFFER-PROJECT-NAME \"clomacs\"." - (if project-name - (let ((result nil)) - (maphash - (lambda (k v) - (let ((current-project-dir (cloamcs-get-dir (cdr k)))) - (if (and current-project-dir - (or (s-contains? project-name current-project-dir) - (s-contains? project-name (buffer-name (cadr v))))) - (setq result (cadr v))))) - sesman-sessions-hashmap) - result) - (cider-current-connection))) - -(defun clomacs-get-connection (&optional library) - "Return buffer with nREPL process related to LIBRARY. + (if project-name + (let ((result nil)) + (maphash + (lambda (k v) + (let ((current-project-dir (clomacs-get-dir (cdr k)))) + (if (and current-project-dir + (or (s-contains? project-name current-project-dir) + (s-contains? project-name (buffer-name (cadr v))))) + (setq result (cadr v))))) + sesman-sessions-hashmap) + result) + (cider-current-connection)))) + +(eval-and-compile + (defun clomacs-get-first-connection () + "Get any first CIDER session buffer." + (-> (sesman-sessions 'CIDER) car cdr car)) + + (defun clomacs-get-connection (&optional library) + "Return buffer with nREPL process related to LIBRARY. If LIBRARY is nil, attempts to use \"clomacs\", \"localhost\" or any current connection. If can't find any nREPL process return nil." - (if library - (or (clomacs-search-connection library) - (if noninteractive (cider-current-repl))) - (or (clomacs-search-connection "clomacs") - (clomacs-search-connection "localhost") - (cider-current-repl)))) + (if library + (or (clomacs-search-connection library) + (if (or noninteractive clomacs-allow-other-repl) + (or (cider-current-repl) + (clomacs-get-first-connection)))) + ;; No `:lib-name' parameter or nil. + (or (clomacs-search-connection "clomacs") + (cider-current-repl) + (clomacs-get-first-connection))))) (defun clomacs-get-session (connection) "Return current session for this CONNECTION." - (assert connection) + (cl-assert connection) (with-current-buffer (set-buffer connection) (cider-nrepl-eval-session))) @@ -265,14 +285,15 @@ PARAMS is a plist optionally containing :project-dir, :jack-in-cmd and (t (replace-regexp-in-string "\\\\." "." (format "'%S" a))))) -(defvar clomacs-possible-return-types - (list :string - :int - :number - :list - :char - :vector - :eval)) +(eval-and-compile + (defvar clomacs-possible-return-types + (list :string + :int + :number + :list + :char + :vector + :eval))) (defun clomacs-highlight-initialize () (font-lock-add-keywords @@ -281,32 +302,34 @@ PARAMS is a plist optionally containing :project-dir, :jack-in-cmd and ("clomacs-def\\b" . font-lock-keyword-face) ("clomacs-with-nrepl\\b" . font-lock-keyword-face)))) -(defun clomacs-force-symbol-name (some-symbol) - "Return lisp symbol SOME-SYMBOL as a string at all costs!" - (mapconcat 'char-to-string - (string-to-list (symbol-name some-symbol)) "")) +(eval-and-compile + (defun clomacs-force-symbol-name (some-symbol) + "Return lisp symbol SOME-SYMBOL as a string at all costs!" + (mapconcat 'char-to-string + (string-to-list (symbol-name some-symbol)) ""))) (eval-after-load "clomacs" (lambda () (clomacs-highlight-initialize))) -(defun clomacs-get-doc (doc cl-entity-name) - "Form the emacs-lisp side entity docstring. +(eval-and-compile + (defun clomacs-get-doc (doc cl-entity-name) + "Form the emacs-lisp side entity docstring. DOC - user-defined docsting. CL-ENTITY-NAME - clojure side entity name. CL-ENTITY-TYPE - \"value\" or \"function\"" - (if doc doc - (format "Wrapped clojure entity: %s%s" - cl-entity-name - (let ((cl-entity-doc (if (clomacs-get-connection) - (condition-case _ - (nrepl-dict-get - (cider-var-info - (symbol-name cl-entity-name)) "doc") - (error nil))))) - (if cl-entity-doc - (concat "\n" cl-entity-doc) - ""))))) + (if doc doc + (format "Wrapped clojure entity: %s%s" + cl-entity-name + (let ((cl-entity-doc (if (clomacs-get-connection) + (condition-case _ + (nrepl-dict-get + (cider-var-info + (symbol-name cl-entity-name)) "doc") + (error nil))))) + (if cl-entity-doc + (concat "\n" cl-entity-doc) + "")))))) (defun clomacs-ensure-nrepl-run (lib-name wrapped-eval @@ -365,31 +388,32 @@ PARAMS is a list of the values for parameters of preceding lambda." (set-text-properties 0 (length str) nil str) str))) -(cl-defun clomacs-prepare-vars (cl-entity-name - &key - (doc nil) - (return-type :string) - namespace) - "Prepare intermediate variables for clomacs wrapper macros." - (cl-assert (and return-type - (or (functionp return-type) - (member return-type clomacs-possible-return-types))) - t - (format (concat "Wrong return-type %s! See C-h v " - "clomacs-possible-return-types") - (clomacs-force-symbol-name return-type))) - (let* ((doc (clomacs-get-doc doc cl-entity-name)) - (cl-entity-name-str (clomacs-force-symbol-name cl-entity-name)) - (ns-slash-pos (string-match "/" cl-entity-name-str)) - (implicit-ns (if ns-slash-pos - (substring cl-entity-name-str 0 ns-slash-pos))) - (namespace-str (if namespace - (clomacs-force-symbol-name namespace) - implicit-ns)) - (cl-entity-full-name (if (and namespace (not implicit-ns)) - (concat namespace-str "/" cl-entity-name-str) - cl-entity-name-str))) - (list doc namespace-str cl-entity-full-name))) +(eval-and-compile + (cl-defun clomacs-prepare-vars (cl-entity-name + &key + (doc nil) + (return-type :string) + namespace) + "Prepare intermediate variables for clomacs wrapper macros." + (cl-assert (and return-type + (or (functionp return-type) + (member return-type clomacs-possible-return-types))) + t + (format (concat "Wrong return-type %s! See C-h v " + "clomacs-possible-return-types") + (clomacs-force-symbol-name return-type))) + (let* ((doc (clomacs-get-doc doc cl-entity-name)) + (cl-entity-name-str (clomacs-force-symbol-name cl-entity-name)) + (ns-slash-pos (string-match "/" cl-entity-name-str)) + (implicit-ns (if ns-slash-pos + (substring cl-entity-name-str 0 ns-slash-pos))) + (namespace-str (if namespace + (clomacs-force-symbol-name namespace) + implicit-ns)) + (cl-entity-full-name (if (and namespace (not implicit-ns)) + (concat namespace-str "/" cl-entity-name-str) + cl-entity-name-str))) + (list doc namespace-str cl-entity-full-name)))) ;;;###autoload (cl-defmacro clomacs-def (el-entity-name -- 2.47.3