[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/racket-mode 5d63fef7c8 7/8: racket-describe-search: No lon
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/racket-mode 5d63fef7c8 7/8: racket-describe-search: No longer show pkg names |
Date: |
Fri, 22 Nov 2024 19:00:44 -0500 (EST) |
branch: elpa/racket-mode
commit 5d63fef7c8a09a293625d1749f2eaf7e72f5d11f
Author: Greg Hendershott <git@greghendershott.com>
Commit: Greg Hendershott <git@greghendershott.com>
racket-describe-search: No longer show pkg names
Just use pkg names behind the scenes for sorting, not for presenting
to end user.
---
racket-describe.el | 7 +++----
racket/lib-pkg.rkt | 23 +++++++++++------------
racket/scribble.rkt | 42 +++++++++++++++++++++---------------------
3 files changed, 35 insertions(+), 37 deletions(-)
diff --git a/racket-describe.el b/racket-describe.el
index 83874b29f9..a9db4dd9da 100644
--- a/racket-describe.el
+++ b/racket-describe.el
@@ -626,7 +626,6 @@ Return nil or \(term path anchor lib\)."
(let* ((affixator (racket--make-affix [16
[16 racket-describe-search-kind]
[32 racket-describe-search-from-libs]
- 16
[0
racket-describe-search-lang-fams]]))
(candidates nil)
(collection
@@ -683,10 +682,10 @@ properties. :( So we append the path and anchor, tab
separated,
as invisible text. Use `racket--describe-search-parse-result' to
extract."
(mapcar
- (pcase-lambda (`(,term ,sort ,what ,from ,fams (,pkg ,pkg-sort)
+ (pcase-lambda (`(,term ,sort ,what ,from ,fams ,pkg-sort
,path ,anchor))
(let* ((term (propertize term
- 'racket-affix (list what from pkg fams)
+ 'racket-affix (list what from fams)
'racket-sort (list (format "%09d" sort)
(format "%09d" pkg-sort))))
(lib (substring from 0 (string-match (rx ?,) from)))
@@ -719,7 +718,7 @@ extract."
(v v)))
(key (v)
(pcase-let
- ((`(,what ,from ,_pkg ,fams)
+ ((`(,what ,from ,fams)
(get-text-property 0 'racket-affix v))
(`(,sort ,pkg-sort)
(get-text-property 0 'racket-sort v)))
diff --git a/racket/lib-pkg.rkt b/racket/lib-pkg.rkt
index cb5af0f597..0c120fe6bd 100644
--- a/racket/lib-pkg.rkt
+++ b/racket/lib-pkg.rkt
@@ -16,7 +16,7 @@
[(get-base-documentation-packages) '("racket-doc")]
[(get-distribution-documentation-packages) '("main-distribution") ])
-(provide lib-pkg)
+(provide lib-pkg-sort)
;; This code for classifying packages as "base" or "main-dist" is
;; borrowed from racket-index/scribblings/main/private/pkg.rkt
@@ -77,8 +77,10 @@
;; all 32K+ xref-index items) and cached.
(define pkg-cache-for-path->pkg (make-hash))
+(define ns (make-base-namespace))
(define (pkg-name mp)
- (match (resolve-module-path mp)
+ (match (parameterize ([current-namespace ns])
+ (resolve-module-path mp))
[(or (? path? p)
(list* 'submod (? path? p)))
(path->pkg p
@@ -86,17 +88,14 @@
[_ #f]))
(define cache (make-hash))
-(define (lib-pkg maybe-mod-path) ;=> (list pkg-name, sort)
+(define (lib-pkg-sort maybe-mod-path)
(hash-ref!
cache
maybe-mod-path
(λ ()
- (cond
- [(module-path? maybe-mod-path)
- (define p (pkg-name maybe-mod-path))
- (list (or p "")
- (cond [(not p) 0]
- [(member p (get-base-pkgs)) 1]
- [(member p (get-main-dist-pkgs)) 2]
- [else 3]))]
- [else (list "" 9)]))))
+ (with-handlers ([exn:fail? (λ _ 9)])
+ (define p (pkg-name maybe-mod-path))
+ (cond [(not p) 0]
+ [(member p (get-base-pkgs)) 1]
+ [(member p (get-main-dist-pkgs)) 2]
+ [else 3])))))
diff --git a/racket/scribble.rkt b/racket/scribble.rkt
index aed4c6de79..118f35995b 100644
--- a/racket/scribble.rkt
+++ b/racket/scribble.rkt
@@ -205,7 +205,7 @@
(match (path->main-doc-relative path)
[(list* 'doc dir _) (~a "in " dir)]
[_ ""]))
- (define-values (what from fams pkg sort-order)
+ (define-values (what from fams pkg-sort sort-order)
(cond
;; New structs
[(exported-index-desc*? desc)
@@ -224,12 +224,12 @@
(define fams (match (hash-ref ht 'language-family #f)
[(? list? fams) (string-join (map ~a fams) ", ")]
[#f "Racket"]))
- (define pkg (lib-pkg
- (match (exported-index-desc-from-libs desc)
- [(cons lib _) lib]
- [_ #f])))
+ (define pkg-sort (lib-pkg-sort
+ (match (exported-index-desc-from-libs desc)
+ [(cons lib _) lib]
+ [_ #f])))
(define sort-order (hash-ref ht 'sort-order 0))
- (values what from fams pkg sort-order)]
+ (values what from fams pkg-sort sort-order)]
[(index-desc? desc)
(define ht (index-desc-extras desc))
(define module-kind (hash-ref ht 'module-kind #f))
@@ -250,12 +250,12 @@
(define fams (match (hash-ref ht 'language-family #f)
[(? list? fams) (string-join (map ~a fams) ", ")]
[#f "Racket"]))
- (define pkg (lib-pkg
- (match module-kind
- ['lib (string->symbol term)]
- [_ #f])))
+ (define pkg-sort (lib-pkg-sort
+ (match module-kind
+ ['lib (string->symbol term)]
+ [_ #f])))
(define sort-order (hash-ref ht 'sort-order 0))
- (values what from fams pkg sort-order)]
+ (values what from fams pkg-sort sort-order)]
;; Older structs
[(exported-index-desc? desc)
(define what
@@ -272,18 +272,18 @@
[(? method-index-desc?) (method-what)]
[_ ""]))
(define from (string-join (map ~s (exported-index-desc-from-libs desc))
", "))
- (define pkg (lib-pkg
- (match (exported-index-desc-from-libs desc)
- [(cons lib _) lib]
- [_ #f])))
- (values what from "" pkg 0)]
+ (define pkg-sort (lib-pkg-sort
+ (match (exported-index-desc-from-libs desc)
+ [(cons lib _) lib]
+ [_ #f])))
+ (values what from "" pkg-sort 0)]
[(module-path-index-desc? desc)
- (define pkg (lib-pkg (string->symbol term)))
- (values "module" "" "" pkg 0)]
+ (define pkg-sort (lib-pkg-sort (string->symbol term)))
+ (values "module" "" "" pkg-sort 0)]
[else
- (define pkg (lib-pkg #f))
- (values "documentation" (doc-from) "" pkg 0)]))
- (list term sort-order what from fams pkg path anchor))
+ (define pkg-sort (lib-pkg-sort #f))
+ (values "documentation" (doc-from) "" pkg-sort 0)]))
+ (list term sort-order what from fams pkg-sort path anchor))
;; This is for package-details
(define (module-doc-path mod-path-str lang?)
- [nongnu] elpa/racket-mode updated (c5bee6895b -> 09f5019321), ELPA Syncer, 2024/11/22
- [nongnu] elpa/racket-mode b54ada52d7 1/8: Change xref var to get-xref function; delete xref-ready-evt, ELPA Syncer, 2024/11/22
- [nongnu] elpa/racket-mode 09f5019321 8/8: racket--describe-search-parse-result: Simplify regexp matching, ELPA Syncer, 2024/11/22
- [nongnu] elpa/racket-mode 26c05316da 5/8: Improve comment, ELPA Syncer, 2024/11/22
- [nongnu] elpa/racket-mode 5259e37f9a 6/8: Re-implement doc index trie with more basic data structures, ELPA Syncer, 2024/11/22
- [nongnu] elpa/racket-mode 46728bbbd3 2/8: Fix bug where only path, no anchor, ELPA Syncer, 2024/11/22
- [nongnu] elpa/racket-mode b9a5874fde 4/8: Simplify "from" for documentation items, ELPA Syncer, 2024/11/22
- [nongnu] elpa/racket-mode 4cf572eb6d 3/8: Show term for "from" when module/lang/reader, ELPA Syncer, 2024/11/22
- [nongnu] elpa/racket-mode 5d63fef7c8 7/8: racket-describe-search: No longer show pkg names,
ELPA Syncer <=