Hello, Lawrence Mitchell <we...@gmx.li> writes:
> * ox.el (org-export-resolve-fuzzy-link): Look for fuzzy link in a > cache before trying to resolve it in the parse tree. Thanks for your patch. A few comments follow. > - (if match-title-p (substring raw-path 1) raw-path)))) > + (if match-title-p (substring raw-path 1) raw-path))) > + (link-cache (plist-get info :fuzzy-link-cache))) > + ;; Cache for locations of fuzzy links that are not position dependent > + (unless link-cache > + (setq info (plist-put info :fuzzy-link-cache > + (make-hash-table :test 'equal))) > + (setq link-cache (plist-get info :fuzzy-link-cache))) Minor nitpick: I'd rather have this included in the (let ...), like: (let (... (link-cache (or (plist-get info :fuzzy-link-cache) (plist-get (setq info (plist-put info :fuzzy-link-cache (make-hash-table :test 'eq))) :fuzzy-link-cache))))) > - (org-element-map (plist-get info :parse-tree) 'target > - (lambda (blob) > - (and (equal (org-split-string (org-element-property :value blob)) > - path) > - blob)) > - info t))) > + (let ((found (gethash (cons 'path path) > + link-cache > + 'fuzzy-link-not-found))) > + (or (not (eq found 'fuzzy-link-not-found)) > + (puthash (cons 'path path) > + (org-element-map (plist-get info :parse-tree) 'target > + (lambda (blob) > + (and (equal (org-split-string > + (org-element-property :value blob)) > + path) > + blob)) > + info t) > + link-cache))))) I don't get why you need to use such a key. Simply use the link as key and `eq' as the test. Regards, -- Nicolas Goaziou