From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: hcel Date: Tue, 20 Sep 2022 17:42:43 -0400 Message-ID: References: <87pmg346k0.fsf@ypei.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6169"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Emacs Devel mailing list To: Yuchen Pei Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 21 01:27:43 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oameV-0001PB-AV for ged-emacs-devel@m.gmane-mx.org; Wed, 21 Sep 2022 01:27:43 +0200 Original-Received: from localhost ([::1]:50060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oameU-0007NY-3G for ged-emacs-devel@m.gmane-mx.org; Tue, 20 Sep 2022 19:27:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oal18-0001Iw-Qf for emacs-devel@gnu.org; Tue, 20 Sep 2022 17:42:58 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:25642) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oal13-0007Ha-ST for emacs-devel@gnu.org; Tue, 20 Sep 2022 17:42:57 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5D90444250E; Tue, 20 Sep 2022 17:42:52 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9760B44259F; Tue, 20 Sep 2022 17:42:45 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1663710165; bh=wnPJLhfm/nSHDXIZ6Tdq9PzuBKJFpP2D6A0wcLEZGoU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=mOvVcySJMg7bEI4iTPdrGrnqnpJg006DbEQo62nV8vleFtXWgEMeqmquhWGhbM1rR h5Ls6IAKoIeqzCkoWj1dX4x8nz057+aICv9h3b0C4/KrZvnFRtb7aERm05nxz+Ckrg YaljDPOMzzWaAnDcUHXlCocM1XixWxbWR9Gp2O88/XpEHHdtwL95Yy+CRyFRofUBob JNrxLwQX8YYqJYK5Fvq+3bZQi7iBdZcosfUWVjm3HOJVqSa3ZHEVdXtt/58J6Qhh04 rBaonBOQHboi5S1HrUKp0ViEH2CHxPnu1bz0HO0qwhHj4CmjsZ/BoeMyYO+smJKPkv +0vG0gu1FEO5w== Original-Received: from pastel (unknown [157.52.9.190]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5A540120A4F; Tue, 20 Sep 2022 17:42:45 -0400 (EDT) In-Reply-To: <87pmg346k0.fsf@ypei.org> (Yuchen Pei's message of "Sun, 11 Sep 2022 01:01:35 +1000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:295841 Archived-At: --=-=-= Content-Type: text/plain BTW, here's a patch with various cosmetic changes. I suggest you read it at least as much as apply it (it contains a few FIXMEs as well). I also attach the many warnings I got when trying to compile it. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=hcel.patch diff --git a/.gitignore b/.gitignore index e4e5f6c8b2..bd5709fcb0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -*~ \ No newline at end of file +*~ +*.elc +/hcel-autoloads.el +/hcel-pkg.el diff --git a/hcel-client.el b/hcel-client.el index ab64ea3293..5ec605574b 100644 --- a/hcel-client.el +++ b/hcel-client.el @@ -138,7 +138,7 @@ (goto-char (point-max)) (insert "[" (current-time-string) "] Request: " url "\n")) (with-current-buffer (url-retrieve-synchronously url t) - (let ((header) (status) (fields) (json)) + (let ((header) (status) (fields)) (delete-http-header) (setq header (hcel-parse-http-header (car kill-ring)) status (alist-get 'status header) diff --git a/hcel-haddorg.el b/hcel-haddorg.el index ad797e0b10..be97e423a2 100644 --- a/hcel-haddorg.el +++ b/hcel-haddorg.el @@ -29,7 +29,7 @@ (module-name (car splitted)) (entity (if (equal "v" (cadr splitted)) "Val" "Typ")) (name (caddr splitted)) - (package) (unparsed) (package-id)) + (package) (package-id)) (goto-char (point-min)) (setq package (org-entry-get (point) "ITEM")) (setq package-id diff --git a/hcel-outline.el b/hcel-outline.el index a46db147f6..78aad54156 100644 --- a/hcel-outline.el +++ b/hcel-outline.el @@ -17,31 +17,33 @@ ;; You should have received a copy of the GNU Affero General Public ;; License along with hcel. If not, see . +(require 'hcel-source) + (defvar hcel-outline-buffer-name "*hcel-outline*") (defvar hcel-outline-indentation 2) (defvar hcel-outline-mode-map (let ((kmap (make-sparse-keymap))) - (define-key kmap "n" 'outline-next-visible-heading) - (define-key kmap "p" 'outline-previous-visible-heading) - (define-key kmap "f" 'outline-forward-same-level) - (define-key kmap "F" 'hcel-outline-follow-mode) - (define-key kmap "b" 'outline-backward-same-level) - (define-key kmap "u" 'outline-up-heading) - (define-key kmap "\t" 'hcel-outline-toggle-children) - (define-key kmap "\r" 'hcel-outline-open-thing-at-point) - (define-key kmap "o" 'hcel-outline-open-thing-at-point-other-window) - (define-key kmap "q" 'quit-window) + (define-key kmap "n" #'outline-next-visible-heading) + (define-key kmap "p" #'outline-previous-visible-heading) + (define-key kmap "f" #'outline-forward-same-level) + (define-key kmap "F" #'hcel-outline-follow-mode) + (define-key kmap "b" #'outline-backward-same-level) + (define-key kmap "u" #'outline-up-heading) + (define-key kmap "\t" #'hcel-outline-toggle-children) + (define-key kmap "\r" #'hcel-outline-open-thing-at-point) + (define-key kmap "o" #'hcel-outline-open-thing-at-point-other-window) + (define-key kmap "q" #'quit-window) kmap)) (define-derived-mode hcel-outline-mode outline-mode "hcel-outline" - "Major mode for browsing Haskell codebases" + "Major mode for browsing Haskell codebases." (setq-local package-filter nil module-filter nil outline-regexp "\\( *\\)." outline-level (lambda () (1+ (/ (length (match-string 1)) hcel-outline-indentation))) - buffer-read-only t)) -(add-hook 'hcel-outline-mode-hook 'hcel-minor-mode) + buffer-read-only t) + (hcel-minor-mode 1)) (defun hcel () (interactive) @@ -61,7 +63,7 @@ (hcel-api-packages))) (hcel-outline-mode)))) -(define-key hcel-mode-map "o" 'hcel) +(define-key hcel-mode-map "o" #'hcel) ;; TODO: maybe remove (defun hcel-outline-update-opened (package-id module-path) @@ -208,8 +210,8 @@ update in the outline mode too." (if (not (eq major-mode 'hcel-outline-mode)) (error "Not in hcel-outline mode!") (add-hook 'post-command-hook - 'hcel-outline-open-thing-at-point-other-window nil t)) + #'hcel-outline-open-thing-at-point-other-window nil t)) (remove-hook 'post-command-hook - 'hcel-outline-open-thing-at-point-other-window t))) + #'hcel-outline-open-thing-at-point-other-window t))) (provide 'hcel-outline) diff --git a/hcel-results.el b/hcel-results.el index a0ce11b049..ff19d26799 100644 --- a/hcel-results.el +++ b/hcel-results.el @@ -24,6 +24,7 @@ ;;; Code: (require 'hcel-utils) +(eval-when-compile (require 'compile)) (defun hcel-results-next-error-no-open (n) (interactive "p") @@ -40,7 +41,7 @@ (goto-char (point-min)) (hcel-results-next-error-internal 1 nil)) (if (> n 0) - (dotimes (unused n) + (dotimes (_unused n) (condition-case nil (progn (goto-char (next-single-property-change (point) 'match-line)) @@ -48,7 +49,7 @@ (goto-char (next-single-property-change (point) 'match-line)))) (error (hcel-results-next-page)))) - (dotimes (unused (- n)) + (dotimes (_unused (- n)) (condition-case nil (progn (goto-char (previous-single-property-change (point) 'match-line)) @@ -68,12 +69,15 @@ (compilation-set-overlay-arrow (selected-window)) (hcel-load-module-location-info (get-text-property (point) 'location-info))) +(defvar-local hcel-results-page-number nil) + (defun hcel-results-next-page () (interactive) + ;; FIXME: Using `major-mode' is a code smell. (unless (memq major-mode '(hcel-refs-mode hcel-ids-mode)) (error "Not in hcel-refs or hcel-ids mode: %S" major-mode)) (when (= hcel-results-page-number hcel-results-max-page-number) - (error "Already on the last page.")) + (error "Already on the last page")) (setq hcel-results-page-number (1+ hcel-results-page-number)) (cond ((eq major-mode 'hcel-refs-mode) (hcel-refs-update-references)) ((eq major-mode 'hcel-ids-mode) (hcel-ids-update)) @@ -100,17 +104,17 @@ (define-compilation-mode hcel-refs-mode "hcel-refs" "Major mode for showing references" - (setq-local next-error-function 'hcel-results-next-error + (setq-local next-error-function #'hcel-results-next-error hcel-refs-id nil hcel-refs-package-id nil hcel-results-page-number nil hcel-results-max-page-number nil)) (define-key hcel-refs-mode-map (kbd "M-n") - 'hcel-results-next-error-no-open) + #'hcel-results-next-error-no-open) (define-key hcel-refs-mode-map (kbd "M-p") - 'hcel-results-previous-error-no-open) + #'hcel-results-previous-error-no-open) (defun hcel-refs-update-references () "Find references and update the current hcel-refs-mode buffer." @@ -159,11 +163,11 @@ (defun hcel-refs-reload () (interactive) (hcel-refs-update-references)) -(define-key hcel-refs-mode-map "g" 'hcel-refs-reload) +(define-key hcel-refs-mode-map "g" #'hcel-refs-reload) -(define-key hcel-refs-mode-map "f" 'hcel-results-next-page) +(define-key hcel-refs-mode-map "f" #'hcel-results-next-page) -(define-key hcel-refs-mode-map "b" 'hcel-results-previous-page) +(define-key hcel-refs-mode-map "b" #'hcel-results-previous-page) (defun hcel-refs-buffer-name (id) (format "*hcel-refs %s*" (hcel-refs-format-id id))) @@ -199,14 +203,14 @@ Start by choosing a package." hcel-results-page-number 1 hcel-results-max-page-number max-page-number) (hcel-refs-update-references))) -(define-key hcel-refs-mode-map "P" 'hcel-refs-update-references-package) +(define-key hcel-refs-mode-map "P" #'hcel-refs-update-references-package) (defun hcel-find-references-at-point () "Find references of the identifier at point." (interactive) (hcel-find-references-internal hcel-package-id hcel-module-path (hcel-text-property-near-point 'identifier))) -(define-key hcel-mode-map (kbd "M-?") 'hcel-find-references-at-point) +(define-key hcel-mode-map (kbd "M-?") #'hcel-find-references-at-point) (defun hcel-minor-find-references-at-point () (interactive) @@ -249,13 +253,13 @@ Start by choosing a package." :group 'hcel-ids) (define-compilation-mode hcel-ids-mode "hcel-ids" "Major mode for showing identifiers" - (setq-local next-error-function 'hcel-results-next-error + (setq-local next-error-function #'hcel-results-next-error hcel-ids-scope nil hcel-ids-query nil hcel-ids-package-id nil hcel-results-page-number nil hcel-results-max-page-number nil)) -(add-hook 'hcel-ids-mode-hook 'hcel-minor-mode) +(add-hook 'hcel-ids-mode-hook #'hcel-minor-mode) (defun hcel-ids-update () (unless (eq major-mode 'hcel-ids-mode) @@ -305,14 +309,14 @@ Start by choosing a package." (defun hcel-ids-reload () (interactive) (hcel-ids-update)) -(define-key hcel-ids-mode-map "g" 'hcel-ids-reload) +(define-key hcel-ids-mode-map "g" #'hcel-ids-reload) (define-key hcel-ids-mode-map (kbd "M-n") - 'hcel-results-next-error-no-open) + #'hcel-results-next-error-no-open) (define-key hcel-ids-mode-map (kbd "M-p") - 'hcel-results-previous-error-no-open) -(define-key hcel-ids-mode-map "f" 'hcel-results-next-page) -(define-key hcel-ids-mode-map "b" 'hcel-results-previous-page) + #'hcel-results-previous-error-no-open) +(define-key hcel-ids-mode-map "f" #'hcel-results-next-page) +(define-key hcel-ids-mode-map "b" #'hcel-results-previous-page) (defun hcel-ids-update-query (query) "Search for identities matching query." @@ -323,7 +327,7 @@ Start by choosing a package." (setq hcel-ids-query query hcel-results-page-number 1) (hcel-ids-update)) -(define-key hcel-ids-mode-map "s" 'hcel-ids-update-query) +(define-key hcel-ids-mode-map "s" #'hcel-ids-update-query) (defun hcel-ids-buffer-name (scope query) (format "*hcel-ids-%S %s*" scope query)) @@ -375,9 +379,9 @@ Start by choosing a package." (interactive (list (let ((minibuffer-allow-text-properties t)) (completing-read "Search for identifier globally: " - 'hcel-global-ids-minibuffer-collection)))) + #'hcel-global-ids-minibuffer-collection)))) (hcel-ids 'global query)) -(define-key hcel-mode-map "I" 'hcel-global-ids) +(define-key hcel-mode-map "I" #'hcel-global-ids) (defun hcel-package-ids (query) (interactive (list @@ -390,6 +394,6 @@ Start by choosing a package." (hcel-format-package-id package-id "-")) (hcel-package-ids-minibuffer-collection package-id))))) (hcel-ids 'package query hcel-package-id)) -(define-key hcel-mode-map "i" 'hcel-package-ids) +(define-key hcel-mode-map "i" #'hcel-package-ids) (provide 'hcel-results) diff --git a/hcel-source.el b/hcel-source.el index 7a793c6ade..2d51672b00 100644 --- a/hcel-source.el +++ b/hcel-source.el @@ -20,17 +20,20 @@ (require 'hcel-client) (define-derived-mode hcel-mode special-mode "hcel" "Major mode for exploring Haskell codebases" - (setq-local eldoc-documentation-strategy 'eldoc-documentation-compose-eagerly + (setq-local eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly eldoc-documentation-functions '(hcel-eldoc-id-type hcel-eldoc-expression-type hcel-eldoc-docs) - imenu-create-index-function 'hcel-imenu-create-index + imenu-create-index-function #'hcel-imenu-create-index imenu-space-replacement " " hcel-identifiers nil hcel-declarations nil hcel-occurrences nil hcel-package-id nil hcel-module-path nil - hcel-highlight-id nil)) + hcel-highlight-id nil) + (cursor-sensor-mode 1) + (add-hook 'xref-backend-functions #'hcel--xref-backend nil t)) + (defun hcel-buffer-name (package-id module-path) (concat "*hcel " (hcel-format-package-id package-id "-") "/" module-path "*")) @@ -65,7 +68,7 @@ When FORCE is non-nil, kill existing source buffer if any." (switch-to-buffer (hcel-load-module-source hcel-package-id hcel-module-path t)) (error "Not in hcel-mode!"))) -(define-key hcel-mode-map "g" 'hcel-reload-module-source) +(define-key hcel-mode-map "g" #'hcel-reload-module-source) (defun hcel-load-module-location-info (location-info &optional no-jump) "Load a module from exact location info. @@ -118,7 +121,7 @@ If NO-JUMP is non-nil, just open the source and does not jump to the location wi 'major-mode (get-buffer (if (stringp buffer) buffer (car buffer)))) 'hcel-mode))))) -(define-key hcel-mode-map "b" 'hcel-switch-buffer) +(define-key hcel-mode-map "b" #'hcel-switch-buffer) (defun hcel-lookup-occurrence-at-point () (when-let ((occurrence (get-text-property (point) 'occurrence))) @@ -224,7 +227,7 @@ If NO-JUMP is non-nil, just open the source and does not jump to the location wi (hcel-outline-load-modules-at-point) (hcel-outline-goto-module module-path) (hcel-outline-load-identifiers-at-point))) -(define-key hcel-mode-map "O" 'hcel-outline-package-module) +(define-key hcel-mode-map "O" #'hcel-outline-package-module) ;; eldoc (defun hcel-eldoc-id-type (cb) @@ -312,7 +315,7 @@ If NO-JUMP is non-nil, just open the source and does not jump to the location wi (defface hcel-highlight-id '((t (:inherit underline))) "Face for highlighting hcel identifier at point.") -(defun hcel-highlight-update (unused unused unused) +(defun hcel-highlight-update (&rest _) ;; if mark is active, change of face will deactivate the mark in transient ;; mark mode (unless mark-active @@ -345,8 +348,6 @@ If NO-JUMP is non-nil, just open the source and does not jump to the location wi (prop-match-beginning match) (prop-match-end match) 'hcel-highlight-id)))))) -(add-hook 'hcel-mode-hook 'cursor-sensor-mode) - ;; utilities (defun hcel-write-source-line-to-buffer (line) (mapc @@ -360,7 +361,7 @@ If NO-JUMP is non-nil, just open the source and does not jump to the location wi 'identifier (unless (string= id "") id) 'occurrence (unless (string= occ "") occ) 'cursor-sensor-functions - (when id (list 'hcel-highlight-update)))))) + (when id (list #'hcel-highlight-update)))))) line)) (defun hcel-write-source-to-buffer (lines) @@ -381,13 +382,13 @@ If NO-JUMP is non-nil, just open the source and does not jump to the location wi 'identifier (unless (string= id "") id) 'occurrence (unless (string= occ "") occ) 'cursor-sensor-functions - (when id (list 'hcel-highlight-update)))))) + (when id (list #'hcel-highlight-update)))))) (dom-by-tag line 'span)) (insert "\n")) (defun hcel-write-html-source-to-buffer (lines) (mapc - 'hcel-write-html-source-line-to-buffer + #'hcel-write-html-source-line-to-buffer lines)) (defun hcel-source-html (json) @@ -410,13 +411,9 @@ If NO-JUMP is non-nil, just open the source and does not jump to the location wi (alist-get 'name decl)) (progn (goto-line (alist-get 'lineNumber decl)) (point)))) hcel-declarations)) -(define-key hcel-mode-map "j" 'imenu) +(define-key hcel-mode-map "j" #'imenu) ;; xref -(add-hook 'hcel-mode-hook - (lambda () - (add-hook 'xref-backend-functions - #'hcel--xref-backend nil t))) (defun hcel--xref-backend () 'hcel-xref) (cl-defmethod xref-backend-definitions ((_backend (eql hcel-xref)) _identifiers) (hcel-find-definition)) @@ -427,10 +424,6 @@ If NO-JUMP is non-nil, just open the source and does not jump to the location wi (hcel-text-property-near-point 'identifier) (hcel-text-property-near-point 'occurrence))) -(add-hook 'hcel-minor-mode-hook - (lambda () - (add-hook 'xref-backend-functions - #'hcel-minor--xref-backend nil t))) (defun hcel-minor--xref-backend () 'hcel-minor-xref) (cl-defmethod xref-backend-definitions ((_backend (eql hcel-minor-xref)) _identifiers) (hcel-minor-find-definition-at-point)) @@ -466,8 +459,7 @@ If NO-JUMP is non-nil, just open the source and does not jump to the location wi (alist-get (intern occurrence) hcel-occurrences))))) (when (string= (hcel-location-tag location-info) "ApproximateLocation") (setq location-info (hcel-approx-to-exact-location location-info))) - (let ((module-path (alist-get 'modulePath location-info)) - (line-beg (alist-get 'startLine location-info)) + (let ((line-beg (alist-get 'startLine location-info)) (col-beg (alist-get 'startColumn location-info)) (line-end (alist-get 'endLine location-info)) (col-end (alist-get 'endColumn location-info))) @@ -494,27 +486,29 @@ If NO-JUMP is non-nil, just open the source and does not jump to the location wi (defvar hcel-minor-mode-map (let ((kmap (make-sparse-keymap))) - (define-key kmap (kbd "M-?") 'hcel-minor-find-references-at-point) + (define-key kmap (kbd "M-?") #'hcel-minor-find-references-at-point) kmap)) (define-minor-mode hcel-minor-mode "A minor mode for exploring haskell codebases." :lighter " hcel-minor" - :after-hook - (if hcel-minor-mode - (if (and (not (memq major-mode hcel-minor-major-modes)) - (not (eq (current-buffer) eldoc--doc-buffer))) - (progn - (hcel-minor-mode 0) - (error "Not in one of the supported modes (%s) or the eldoc buffer." - (string-join (mapcar 'prin1-to-string hcel-minor-major-modes) - ", "))) - (add-hook - 'eldoc-documentation-functions #'hcel-minor-eldoc-docs nil t) - (add-hook - 'eldoc-documentation-functions #'hcel-minor-eldoc-id-type nil t) - (setq-local eldoc-documentation-strategy 'eldoc-documentation-compose)) + (add-hook 'xref-backend-functions + #'hcel-minor--xref-backend nil t) + (cond + ((null hcel-minor-mode) (remove-hook 'eldoc-documentation-functions #'hcel-minor-eldoc-id-type t) - (remove-hook 'eldoc-documentation-functions #'hcel-minor-eldoc-docs t))) + (remove-hook 'eldoc-documentation-functions #'hcel-minor-eldoc-docs t)) + ((not (or (memq major-mode hcel-minor-major-modes) + (eq (current-buffer) eldoc--doc-buffer))) + (setq hcel-minor-mode nil) + (error "Not in one of the supported modes (%s) or the eldoc buffer." + (mapconcat #'prin1-to-string hcel-minor-major-modes + ", "))) + (t + (add-hook + 'eldoc-documentation-functions #'hcel-minor-eldoc-docs nil t) + (add-hook + 'eldoc-documentation-functions #'hcel-minor-eldoc-id-type nil t) + (setq-local eldoc-documentation-strategy 'eldoc-documentation-compose)))) (provide 'hcel-source) diff --git a/hcel-utils.el b/hcel-utils.el index e5a82e7a1b..1e1afea1eb 100644 --- a/hcel-utils.el +++ b/hcel-utils.el @@ -77,6 +77,7 @@ Example of an idSrcSpan: (col-end (alist-get 'column (alist-get 'end span)))) (buffer-substring-line-column line-beg (1- col-beg) line-end (1- col-end)))) +;; FIXME: Make sure all your definitions have an `hcel-' prefix! ;; buffers and strings manipulation (defun goto-line-column (line column) (goto-line line) diff --git a/hc.el b/hcel.el similarity index 86% rename from hc.el rename to hcel.el index f6239f6dbc..bdfe65cbe6 100644 --- a/hc.el +++ b/hcel.el @@ -1,11 +1,11 @@ -;;; hc.el --- Haskell codebase explorer -*- lexical-binding: t; -*- +;;; hcel.el --- Haskell codebase explorer -*- lexical-binding: t; -*- ;; Author: Yuchen Pei ;; Maintainer: Yuchen Pei ;; Created: 2022 ;; Version: 0 ;; Keywords: haskell -;; Package-Requires: ((emacs "28") (haskell-mode)) +;; Package-Requires: ((emacs "28")) ;; Package-Type: multi ;; Homepage: https://g.ypei.me/hcel.git @@ -36,9 +36,10 @@ (interactive (list (completing-read "Select package: " - (mapcar 'hcel-format-package-id + (mapcar #'hcel-format-package-id (hcel-api-packages))))) - (call-interactively (hcel-module-selector (hcel-parse-package-id package-id)))) + (call-interactively + (hcel-module-selector (hcel-parse-package-id package-id)))) (defun hcel-module () "Select a module to display source." @@ -56,3 +57,4 @@ (hcel-load-module-source package-id module-path)))) (provide 'hc) +;;; hcel.el ends here. --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline; filename=hcel.warnings Content-Transfer-Encoding: quoted-printable Byte compiling packages/hcel/hcel-client.el Byte compiling packages/hcel/hcel.el Byte compiling packages/hcel/hcel-haddorg.el Byte compiling packages/hcel/hcel-outline.el In toplevel form: packages/hcel/hcel-client.el:20:12: Warning: defcustom for =E2=80=98hcel-ho= st=E2=80=99 fails to specify type packages/hcel/hcel-client.el:23:12: Warning: defcustom for =E2=80=98hcel-in= dexed-dir=E2=80=99 fails to specify type In end of data: packages/hcel/hcel-client.el:142:8: Warning: the function =E2=80=98delete-h= ttp-header=E2=80=99 is not known to be defined. packages/hcel/hcel-client.el:59:19: Warning: the function =E2=80=98hcel-loc= ation-tag=E2=80=99 is not known to be defined. packages/hcel/hcel-client.el:47:43: Warning: the function =E2=80=98hcel-for= mat-package-id=E2=80=99 is not known to be defined. Byte compiling packages/hcel/hcel-results.el In end of data: packages/hcel/hcel-haddorg.el:27:17: Warning: the function =E2=80=98org-ent= ry-get=E2=80=99 is not known to be defined. packages/hcel/hcel-haddorg.el:26:6: Warning: the function =E2=80=98org-back= -to-heading=E2=80=99 is not known to be defined. Byte compiling packages/hcel/hcel-source.el In end of data: packages/hcel/hcel-outline.el:125:29: Warning: the function =E2=80=98outlin= e-toggle-children=E2=80=99 is not known to be defined. packages/hcel/hcel-outline.el:58:23: Warning: the function =E2=80=98hcel-fo= rmat-package-id=E2=80=99 is not known to be defined. packages/hcel/hcel-outline.el:32:29: Warning: the function =E2=80=98outline= -up-heading=E2=80=99 is not known to be defined. packages/hcel/hcel-outline.el:31:29: Warning: the function =E2=80=98outline= -backward-same-level=E2=80=99 is not known to be defined. packages/hcel/hcel-outline.el:29:29: Warning: the function =E2=80=98outline= -forward-same-level=E2=80=99 is not known to be defined. packages/hcel/hcel-outline.el:28:29: Warning: the function =E2=80=98outline= -previous-visible-heading=E2=80=99 is not known to be defined. packages/hcel/hcel-outline.el:27:29: Warning: the function =E2=80=98outline= -next-visible-heading=E2=80=99 is not known to be defined. Byte compiling packages/hcel/hcel-utils.el In hcel-module: packages/hcel/hcel.el:48:26: Warning: reference to free variable =E2=80=98h= cel-package-id=E2=80=99 In hcel-module-selector: packages/hcel/hcel.el:55:43: Warning: reference to free variable =E2=80=98p= ackage-id=E2=80=99 In end of data: packages/hcel/hcel.el:55:25: Warning: the function =E2=80=98hcel-list-modul= es=E2=80=99 is not known to be defined. In goto-line-column: packages/hcel/hcel-utils.el:83:4: Warning: =E2=80=98goto-line=E2=80=99 is f= or interactive use only; use =E2=80=98forward-line=E2=80=99 instead. In hcel-results-next-page: packages/hcel/hcel-results.el:79:37: Warning: reference to free variable = =E2=80=98hcel-results-max-page-number=E2=80=99 packages/hcel/hcel-results.el:101:12: Warning: defcustom for =E2=80=98hcel-= refs-per-page=E2=80=99 fails to specify type In hcel-load-module-source: packages/hcel/hcel-source.el:56:17: Warning: assignment to free variable = =E2=80=98hcel-declarations=E2=80=99 packages/hcel/hcel-source.el:57:17: Warning: assignment to free variable = =E2=80=98hcel-identifiers=E2=80=99 packages/hcel/hcel-source.el:58:17: Warning: assignment to free variable = =E2=80=98hcel-occurrences=E2=80=99 packages/hcel/hcel-source.el:59:17: Warning: assignment to free variable = =E2=80=98hcel-package-id=E2=80=99 packages/hcel/hcel-source.el:60:17: Warning: assignment to free variable = =E2=80=98hcel-module-path=E2=80=99 In hcel-reload-module-source: packages/hcel/hcel-source.el:69:33: Warning: reference to free variable =E2= =80=98hcel-package-id=E2=80=99 packages/hcel/hcel-source.el:69:49: Warning: reference to free variable =E2= =80=98hcel-module-path=E2=80=99 In hcel-load-module-location-info: packages/hcel/hcel-source.el:73:2: Warning: docstring wider than 80 charact= ers In end of data: packages/hcel/hcel-utils.el:109:8: Warning: the function =E2=80=98haskell-m= ode=E2=80=99 is not known to be defined. packages/hcel/hcel-utils.el:49:15: Warning: the function =E2=80=98hcel-defi= nition-site-location-info=E2=80=99 is not known to be defined. In hcel-refs-update-references: packages/hcel/hcel-results.el:126:11: Warning: reference to free variable = =E2=80=98hcel-refs-package-id=E2=80=99 packages/hcel/hcel-results.el:126:32: Warning: reference to free variable = =E2=80=98hcel-refs-id=E2=80=99 packages/hcel/hcel-results.el:133:46: Warning: reference to free variable = =E2=80=98hcel-results-max-page-number=E2=80=99 In hcel-refs-update-references-package: packages/hcel/hcel-results.el:187:51: Warning: reference to free variable = =E2=80=98hcel-refs-id=E2=80=99 packages/hcel/hcel-results.el:202:11: Warning: assignment to free variable = =E2=80=98hcel-refs-package-id=E2=80=99 packages/hcel/hcel-results.el:204:11: Warning: assignment to free variable = =E2=80=98hcel-results-max-page-number=E2=80=99 In hcel-find-references-at-point: packages/hcel/hcel-results.el:211:34: Warning: reference to free variable = =E2=80=98hcel-package-id=E2=80=99 packages/hcel/hcel-results.el:211:50: Warning: reference to free variable = =E2=80=98hcel-module-path=E2=80=99 packages/hcel/hcel-results.el:213:13: Warning: reference to free variable = =E2=80=98hcel-mode-map=E2=80=99 In hcel-find-references-internal: packages/hcel/hcel-results.el:240:57: Warning: reference to free variable = =E2=80=98hcel-identifiers=E2=80=99 packages/hcel/hcel-results.el:244:19: Warning: assignment to free variable = =E2=80=98hcel-refs-id=E2=80=99 packages/hcel/hcel-results.el:248:12: Warning: defcustom for =E2=80=98hcel-= ids-per-page=E2=80=99 fails to specify type packages/hcel/hcel-results.el:251:12: Warning: defcustom for =E2=80=98hcel-= ids-live-per-page=E2=80=99 fails to specify type In hcel-ids-update: packages/hcel/hcel-results.el:267:18: Warning: reference to free variable = =E2=80=98hcel-ids-scope=E2=80=99 packages/hcel/hcel-results.el:267:48: Warning: reference to free variable = =E2=80=98hcel-ids-package-id=E2=80=99 packages/hcel/hcel-results.el:272:27: Warning: reference to free variable = =E2=80=98hcel-ids-query=E2=80=99 packages/hcel/hcel-results.el:277:11: Warning: assignment to free variable = =E2=80=98hcel-results-max-page-number=E2=80=99 packages/hcel/hcel-results.el:284:21: Warning: reference to free variable = =E2=80=98hcel-results-max-page-number=E2=80=99 In hcel-ids-update-query: packages/hcel/hcel-results.el:326:47: Warning: reference to free variable = =E2=80=98hcel-ids-query=E2=80=99 packages/hcel/hcel-results.el:327:9: Warning: assignment to free variable = =E2=80=98hcel-ids-query=E2=80=99 In hcel-global-ids-minibuffer-collection: packages/hcel/hcel-results.el:357:60: Warning: repeated variable unused in = lambda-list packages/hcel/hcel-results.el:357:53: Warning: Unused lexical argument `unu= sed' packages/hcel/hcel-results.el:357:60: Warning: Unused lexical argument `unu= sed' In hcel-package-ids-minibuffer-collection: packages/hcel/hcel-results.el:361:25: Warning: repeated variable unused in = lambda-list packages/hcel/hcel-results.el:361:18: Warning: Unused lexical argument `unu= sed' packages/hcel/hcel-results.el:361:25: Warning: Unused lexical argument `unu= sed' In hcel-ids: packages/hcel/hcel-results.el:373:15: Warning: assignment to free variable = =E2=80=98hcel-ids-scope=E2=80=99 packages/hcel/hcel-results.el:374:15: Warning: assignment to free variable = =E2=80=98hcel-ids-package-id=E2=80=99 In hcel-package-ids: packages/hcel/hcel-results.el:389:35: Warning: reference to free variable = =E2=80=98hcel-package-id=E2=80=99 In end of data: packages/hcel/hcel-results.el:292:39: Warning: the function =E2=80=98hcel-d= efinition-site-location-info=E2=80=99 is not known to be defined. packages/hcel/hcel-results.el:271:12: Warning: the function =E2=80=98hcel-a= pi-identifiers=E2=80=99 is not known to be defined. packages/hcel/hcel-results.el:262:33: Warning: the function =E2=80=98hcel-m= inor-mode=E2=80=99 is not known to be defined. packages/hcel/hcel-results.el:235:23: Warning: the function =E2=80=98hcel-l= oad-module-source=E2=80=99 is not known to be defined. packages/hcel/hcel-results.el:232:25: Warning: the function =E2=80=98hcel-b= uffer-name=E2=80=99 is not known to be defined. packages/hcel/hcel-results.el:187:24: Warning: the function =E2=80=98hcel-a= pi-global-references=E2=80=99 is not known to be defined. packages/hcel/hcel-results.el:125:11: Warning: the function =E2=80=98hcel-a= pi-references=E2=80=99 is not known to be defined. packages/hcel/hcel-results.el:70:4: Warning: the function =E2=80=98hcel-loa= d-module-location-info=E2=80=99 is not known to be defined. packages/hcel/hcel-results.el:69:4: Warning: the function =E2=80=98compilat= ion-set-overlay-arrow=E2=80=99 might not be defined at runtime. In hcel-lookup-occurrence-at-point: packages/hcel/hcel-source.el:128:36: Warning: reference to free variable = =E2=80=98hcel-occurrences=E2=80=99 In hcel-type-at-point: packages/hcel/hcel-source.el:145:30: Warning: reference to free variable = =E2=80=98hcel-package-id=E2=80=99 packages/hcel/hcel-source.el:145:46: Warning: reference to free variable = =E2=80=98hcel-module-path=E2=80=99 In hcel-render-type-internal: packages/hcel/hcel-source.el:153:59: Warning: reference to free variable = =E2=80=98hcel-identifiers=E2=80=99 In hcel-id-docs-at-point: packages/hcel/hcel-source.el:174:26: Warning: reference to free variable = =E2=80=98hcel-package-id=E2=80=99 packages/hcel/hcel-source.el:174:42: Warning: reference to free variable = =E2=80=98hcel-module-path=E2=80=99 In hcel-id-docs-internal: packages/hcel/hcel-source.el:183:51: Warning: reference to free variable = =E2=80=98hcel-identifiers=E2=80=99 In hcel-expressions-type: packages/hcel/hcel-source.el:215:45: Warning: reference to free variable = =E2=80=98hcel-package-id=E2=80=99 packages/hcel/hcel-source.el:216:45: Warning: reference to free variable = =E2=80=98hcel-module-path=E2=80=99 In hcel-outline-package-module: packages/hcel/hcel-source.el:223:21: Warning: reference to free variable = =E2=80=98hcel-package-id=E2=80=99 packages/hcel/hcel-source.el:224:22: Warning: reference to free variable = =E2=80=98hcel-module-path=E2=80=99 In hcel-eldoc-id-type: packages/hcel/hcel-source.el:239:28: Warning: reference to free variable = =E2=80=98hcel-package-id=E2=80=99 packages/hcel/hcel-source.el:240:29: Warning: reference to free variable = =E2=80=98hcel-module-path=E2=80=99 In hcel-highlight-update: packages/hcel/hcel-source.el:324:27: Warning: reference to free variable = =E2=80=98hcel-highlight-id=E2=80=99 packages/hcel/hcel-source.el:327:15: Warning: assignment to free variable = =E2=80=98hcel-highlight-id=E2=80=99 In hcel-imenu-create-index: packages/hcel/hcel-source.el:412:15: Warning: =E2=80=98goto-line=E2=80=99 i= s for interactive use only; use =E2=80=98forward-line=E2=80=99 instead. packages/hcel/hcel-source.el:413:4: Warning: reference to free variable =E2= =80=98hcel-declarations=E2=80=99 In hcel-find-definition: packages/hcel/hcel-source.el:423:4: Warning: reference to free variable =E2= =80=98hcel-package-id=E2=80=99 packages/hcel/hcel-source.el:423:20: Warning: reference to free variable = =E2=80=98hcel-module-path=E2=80=99 In hcel-find-definition-internal: packages/hcel/hcel-source.el:457:50: Warning: reference to free variable = =E2=80=98hcel-identifiers=E2=80=99 packages/hcel/hcel-source.el:459:50: Warning: reference to free variable = =E2=80=98hcel-occurrences=E2=80=99 In end of data: packages/hcel/hcel-source.el:489:36: Warning: the function =E2=80=98hcel-mi= nor-find-references-at-point=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:477:30: Warning: the function =E2=80=98xref-ma= ke-buffer-location=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:475:29: Warning: the function =E2=80=98xref-ma= ke-match=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:461:34: Warning: the function =E2=80=98hcel-ap= prox-to-exact-location=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:408:8: Warning: the function =E2=80=98hcel-ren= der-components=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:397:6: Warning: the function =E2=80=98dom-by-c= lass=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:386:5: Warning: the function =E2=80=98dom-by-t= ag=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:379:23: Warning: the function =E2=80=98dom-tex= t=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:377:18: Warning: the function =E2=80=98dom-att= r=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:252:29: Warning: the function =E2=80=98text-pr= operty-search-backward=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:229:6: Warning: the function =E2=80=98hcel-out= line-load-identifiers-at-point=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:228:6: Warning: the function =E2=80=98hcel-out= line-goto-module=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:227:6: Warning: the function =E2=80=98hcel-out= line-load-modules-at-point=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:226:6: Warning: the function =E2=80=98hcel-out= line-goto-package=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:225:6: Warning: the function =E2=80=98hcel=E2= =80=99 is not known to be defined. packages/hcel/hcel-source.el:219:14: Warning: the function =E2=80=98hcel-ex= pression-and-type=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:208:25: Warning: the function =E2=80=98current= -line=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:199:14: Warning: the function =E2=80=98hcel-re= nder-html=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:159:15: Warning: the function =E2=80=98hcel-re= nder-id-type=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:141:6: Warning: the function =E2=80=98buffer-s= ubstring-line-column=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:136:21: Warning: the function =E2=80=98hcel-te= xt-property-near-point=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:105:8: Warning: the function =E2=80=98goto-lin= e-column=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:94:21: Warning: the function =E2=80=98hcel-loc= ation-tag=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:52:12: Warning: the function =E2=80=98fontify-= with-haskell-mode=E2=80=99 is not known to be defined. packages/hcel/hcel-source.el:38:21: Warning: the function =E2=80=98hcel-for= mat-package-id=E2=80=99 is not known to be defined. --=-=-=--