diff --git a/README.md b/README.md index c33658a2..6a9a9fd5 100644 --- a/README.md +++ b/README.md @@ -463,18 +463,19 @@ In case you want to use a different spinner type you can modify `rustic-spinner- ## inline-documentation With some setup, it is possible to read rust documentation inside Emacs! This currently requires LSP-mode. +![Rustic-doc example](img/rustic-doc.png) ### Prequisites * Install Pandoc https://pandoc.org/installing.html * Install cargo https://doc.rust-lang.org/cargo/getting-started/installation.html * Install helm-ag https://github.com/emacsorphanage/helm-ag (Optional, but highly recommended) -If you do not have them, you will be prompted to install `fd-find`, `ripgrep` and `cargo-makedocs` when you run `rustic-doc-setup`. -`ripgrep` is optional but highly recommended. -If helm-ag and ripgrep is installed, those will be used by default. -If only ripgrep is installed, it will be used with the emacs `grep` command. -If neither is installed, the emacs `grep` command will use `grep`, like in the good old days. -You can change this by providing your own search function by changing `rustic-doc-search-function`. +* If you do not have them, you will be prompted to install `fd-find`, `ripgrep` and `cargo-makedocs` when you run `rustic-doc-setup`. + * `ripgrep` is optional but highly recommended. + * If helm-ag and ripgrep is installed, those will be used by default. + * If only ripgrep is installed, it will be used with the emacs `grep` command. + * If neither is installed, the emacs `grep` command will use `grep`, like in the good old days. + * You can change this by providing your own search function by changing `rustic-doc-search-function`. ### Usage diff --git a/img/rustic-doc.png b/img/rustic-doc.png new file mode 100644 index 00000000..86033439 Binary files /dev/null and b/img/rustic-doc.png differ diff --git a/rustic-doc.el b/rustic-doc.el index 6b8a5fdf..03086660 100644 --- a/rustic-doc.el +++ b/rustic-doc.el @@ -241,6 +241,7 @@ If the user has not visited a project, returns the main doc directory." ;; strings out of cargo, or just parse the Cargo.toml file, but ;; then we'd have to review different parsing solutions. (finish-func (lambda (_p) + (message (format "Finished converting docs for %s" rustic-doc-current-project))))) (rustic-doc-create-project-dir) @@ -276,7 +277,7 @@ If the user has not visited a project, returns the main doc directory." (message "Setup is converting the standard library") (delete-directory (concat rustic-doc-save-loc "/std") t) - (rustic-doc--start-process "*rustic-doc-std-conversion*" + (rustic-doc--start-process "rustic-doc-std-conversion" rustic-doc-convert-prog (lambda (_p) (message "Finished converting docs for std")) @@ -287,14 +288,17 @@ If the user has not visited a project, returns the main doc directory." (proc (let ((process-connection-type nil)) (apply #'start-process name buf program program-args)))) (set-process-sentinel - proc (lambda (proc _event) + proc (lambda (proc event) (let ((buf (process-buffer proc))) - (when finish-func - (funcall finish-func proc)) - (when (buffer-live-p buf) - (kill-buffer buf))))) + (if (string-match-p (regexp-quote "abnormally") event) + (message "Could not finish process: %s. See the *Messages* buffer or %s for more info." event (concat "*" name "*")) + (when finish-func + (funcall finish-func proc)) + (when (buffer-live-p buf) + (kill-buffer buf)))))) proc)) + (defun rustic-doc--thing-at-point () "Return info about `thing-at-point'. If `thing-at-point' is nil, return defaults." (if-let ((active lsp-mode) diff --git a/rustic-doc/convert.sh b/rustic-doc/convert.sh index 56e6f353..cb52964e 100755 --- a/rustic-doc/convert.sh +++ b/rustic-doc/convert.sh @@ -47,11 +47,16 @@ BEGIN { m = length(PRE) ' \ > "$ignore_file" +if [[ "$OSTYPE" == "darwin"* ]]; then + cores=$(eval "$sysctl -n hw.logicalcpu") +else + cores=$(nproc) +fi ## Convert files fd . \ -ehtml \ --ignore-file "$ignore_file" \ - -j"$(nproc)" \ + -j"$cores" \ -x pandoc '{}' \ --lua-filter "$LUA_FILTER" \ -o "$DEST_DIR/{.}.org"