Reduce the `cl-lib' dependency and fix minor bugs in the process
This commit is contained in:
parent
5d6a749a77
commit
6e0d21f7b7
48
README.org
48
README.org
@ -1238,7 +1238,7 @@ sub makeglossaries {
|
||||
(with-current-buffer buffer
|
||||
(let ((mode major-mode))
|
||||
(push mode result))))
|
||||
(cl-sort (cl-remove-duplicates result) #'string-lessp)))
|
||||
(sort (cl-remove-duplicates result))))
|
||||
#+end_src
|
||||
|
||||
|
||||
@ -1977,9 +1977,9 @@ configuration objectives:
|
||||
(defun update-lualatex-opentype-font-name-database ()
|
||||
"Update the \"OpenType Font\" name database for \"LuaLaTeX\"."
|
||||
(interactive)
|
||||
(cl-destructuring-bind (exit-code output)
|
||||
(pcase-let ((`(,exit-code ,output)
|
||||
(shell-command-with-exit-code
|
||||
"luaotfload-tool" "-vv" "--update" "--force")
|
||||
"luaotfload-tool" "-vv" "--update" "--force")))
|
||||
(if (= 0 exit-code)
|
||||
(message "%s" (string-trim output))
|
||||
(error "%s" (string-trim output))))))
|
||||
@ -2529,7 +2529,7 @@ def __org_babel_python_format_value(result, result_file, result_params):
|
||||
result)))))
|
||||
result))
|
||||
|
||||
(mapcar #'list (cl-sort (org-babel-active-languages) #'string-lessp))
|
||||
(mapcar #'list (sort (org-babel-active-languages)))
|
||||
#+end_src
|
||||
|
||||
#+caption[Active Org Babel languages]:
|
||||
@ -2642,8 +2642,8 @@ valid directories and files. In an [[https://orgmode.org/][Org-mode]] buffer th
|
||||
(defun biber-delete-cache ()
|
||||
"Delete the `Biber' cache to get rid of `Biber' exit code 2."
|
||||
(interactive)
|
||||
(cl-destructuring-bind (exit-code output)
|
||||
(shell-command-with-exit-code "rm" "-rf" "$(biber --cache)")
|
||||
(pcase-let ((`(,exit-code ,output)
|
||||
(shell-command-with-exit-code "rm" "-rf" "$(biber --cache)")))
|
||||
(if (= 0 exit-code)
|
||||
(message "%s" (string-trim output))
|
||||
(error "%s" (string-trim output))))))
|
||||
@ -4867,40 +4867,38 @@ through =cat= to remove escape sequences.
|
||||
(when (executable-find "pyenv")
|
||||
(defun pyenv-full-path (version)
|
||||
"Return the full path for VERSION."
|
||||
(unless (string= version "system")
|
||||
(concat (pyenv-root) (file-name-as-directory "versions") version)))
|
||||
(concat (pyenv-root) (file-name-as-directory "versions") version))
|
||||
|
||||
(defun pyenv-root ()
|
||||
"Return \"pyenv root\" as a directory."
|
||||
(cl-destructuring-bind (exit-code output)
|
||||
(shell-command-with-exit-code "pyenv" "root")
|
||||
(pcase-let ((`(,exit-code ,output)
|
||||
(shell-command-with-exit-code "pyenv" "root")))
|
||||
(if (= 0 exit-code)
|
||||
(file-name-as-directory (string-trim output))
|
||||
(error "%s" (string-trim output)))))
|
||||
|
||||
(defun pyenv-version-name ()
|
||||
"Return \"pyenv version-name\"."
|
||||
(cl-destructuring-bind (exit-code output)
|
||||
(shell-command-with-exit-code "pyenv" "version-name")
|
||||
(pcase-let ((`(,exit-code ,output)
|
||||
(shell-command-with-exit-code "pyenv" "version-name")))
|
||||
(if (= 0 exit-code)
|
||||
(string-trim output)
|
||||
(error "%s" (string-trim output)))))
|
||||
|
||||
(defun pyenv-versions ()
|
||||
"Return \"pyenv versions --bare --skip-aliases\" as a list.
|
||||
Complete the result with \"system\"."
|
||||
(cl-destructuring-bind (exit-code output)
|
||||
"Return \"pyenv versions --bare --skip-aliases\" as a list."
|
||||
(pcase-let ((`(,exit-code ,output)
|
||||
(shell-command-with-exit-code
|
||||
"pyenv" "versions" "--bare" "--skip-aliases")
|
||||
"pyenv" "versions" "--bare" "--skip-aliases")))
|
||||
(if (= 0 exit-code)
|
||||
(cons "system" (split-string output))
|
||||
(split-string output)
|
||||
(error "%s" (string-trim output)))))
|
||||
|
||||
(defun pyenv-virtualenvs ()
|
||||
"Return \"pyenv virtualenvs --bare --skip-aliases\" as a list."
|
||||
(cl-destructuring-bind (exit-code output)
|
||||
(pcase-let ((`(,exit-code ,output)
|
||||
(shell-command-with-exit-code
|
||||
"pyenv" "virtualenvs" "--bare" "--skip-aliases")
|
||||
"pyenv" "virtualenvs" "--bare" "--skip-aliases")))
|
||||
(if (= 0 exit-code)
|
||||
(split-string output)
|
||||
(error "%s" (string-trim output))))))
|
||||
@ -4911,10 +4909,10 @@ Complete the result with \"system\"."
|
||||
#+name: lst:select-python-virtual-environment
|
||||
#+begin_src emacs-lisp -n :results silent
|
||||
(with-eval-after-load 'python
|
||||
(when (cl-every #'fboundp '(pyenv-full-path
|
||||
pyenv-version-name
|
||||
pyenv-versions
|
||||
pyenv-virtualenvs))
|
||||
(when (and (fboundp 'pyenv-full-path)
|
||||
(fboundp 'pyenv-version-name)
|
||||
(fboundp 'pyenv-versions)
|
||||
(fboundp 'pyenv-virtualenvs))
|
||||
(setq python-shell-virtualenv-root
|
||||
(pyenv-full-path (or (pyenv-version-name)
|
||||
(car (pyenv-virtualenvs))
|
||||
@ -4923,7 +4921,7 @@ Complete the result with \"system\"."
|
||||
python-shell-virtualenv-root)
|
||||
|
||||
(defun set-python-shell-virtualenv-root-to-pyenv-version ()
|
||||
"Set `python-shell-virtual-env-root' to a pyenv version."
|
||||
"Set `python-shell-virtualenv-root' to a pyenv version."
|
||||
(interactive)
|
||||
(let* ((version-name (pyenv-version-name))
|
||||
(prompt (format "pyenv version (%s): " version-name))
|
||||
@ -4936,7 +4934,7 @@ Complete the result with \"system\"."
|
||||
python-shell-virtualenv-root)))
|
||||
|
||||
(defun set-python-shell-virtualenv-root-to-pyenv-virtualenv ()
|
||||
"Set `python-shell-virtual-env-root' to a pyenv virtualenv."
|
||||
"Set `python-shell-virtualenv-root' to a pyenv virtualenv."
|
||||
(interactive)
|
||||
(let* ((version-name (pyenv-version-name))
|
||||
(prompt (format "pyenv virtualenv (%s): " version-name))
|
||||
|
Loading…
Reference in New Issue
Block a user