Skip to content

Commit

Permalink
Finally use a synchronous process for library desc
Browse files Browse the repository at this point in the history
  • Loading branch information
thierryvolpiatto committed Nov 8, 2023
1 parent fe227c4 commit 2534c22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
6 changes: 0 additions & 6 deletions helm-elisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -893,12 +893,6 @@ a string, i.e. the `symbol-name' of any existing symbol."
;;; Locate elisp library
;;
;;
;; FIXME: Maybe I make an error of implementation here, building the caches in
;; the transformer force the usage of an asynchronous function to build the doc
;; of each library, maybe it would be simpler to make the caches in :init and use
;; a simple transformer using gethash to fetch doc and path of each candidate. And
;; `helm-locate-lib-get-summary' could use a synchronous process.

(defvar helm--locate-library-cache nil)
(defvar helm--locate-library-doc-cache (make-hash-table :test 'equal))
(defun helm-locate-library-scan-list ()
Expand Down
21 changes: 4 additions & 17 deletions helm-lib.el
Original file line number Diff line number Diff line change
Expand Up @@ -1756,28 +1756,15 @@ Directories expansion is not supported."
(cmd "%s %s | head -n1 | awk 'match($0,\"%s\",a) {print a[2]}'\
| awk -F ' -*-' '{print $1}'")
(regexp "^;;;(.*) ---? (.*)$")
(proc (start-process-shell-command
"helm-locate-lib-get-summary" "*helm locate lib*"
(desc (shell-command-to-string
(format cmd
(if (string-match-p "\\.gz\\'" file)
"gzip -c -q -d" "cat")
(shell-quote-argument file)
regexp)))
output)
(set-process-sentinel
proc (lambda (process event)
(when (and (string= event "finished\n")
(process-buffer process))
(with-current-buffer (process-buffer process)
(setq output
(replace-regexp-in-string
"\n" ""
(buffer-string)))
(erase-buffer)))))
(while (accept-process-output proc))
(if (string= output "")
regexp))))
(if (string= desc "")
"Not documented"
output)))
(replace-regexp-in-string "\n" "" desc))))

;;; helm internals
;;
Expand Down

0 comments on commit 2534c22

Please sign in to comment.