;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\303\304\305\306\307DD\310\311\312\313\314&\210\303\315\305\306\316DD\317\311\312\313\320&\207" [require cl-lib haskell-utils custom-declare-variable haskell-hasktags-path funcall function #[0 "\300\207" [#1="hasktags"] 1 #1#] "Path to `hasktags' executable." :group haskell :type string haskell-hasktags-arguments #[0 "\300\207" [("-e" "-x")] 1] "Additional arguments for `hasktags' executable.\nBy default these are:\n\n-e - generate ETAGS file\n-x - generate additional information in CTAGS file." (list string)] 8) (defconst haskell-cabal-general-fields '("name" "version" "cabal-version" "license" "license-file" "copyright" "author" "maintainer" "stability" "homepage" "package-url" "synopsis" "description" "category" "tested-with" "build-depends" "data-files" "extra-source-files" "extra-tmp-files" "import")) (defconst haskell-cabal-library-fields '("exposed-modules")) (defconst haskell-cabal-executable-fields '("executable" "main-is")) (defconst haskell-cabal-buildinfo-fields '("buildable" "other-modules" "hs-source-dirs" "extensions" "ghc-options" "ghc-prof-options" "hugs-options" "nhc-options" "includes" "install-includes" "include-dirs" "c-sources" "extra-libraries" "extra-lib-dirs" "cc-options" "ld-options" "frameworks")) (defvar haskell-cabal-mode-syntax-table (byte-code "\300 \301\302\303#\210\301\304\305#\210\207" [make-syntax-table modify-syntax-entry 10 ">" 45 "w"] 5)) (defvar haskell-cabal-font-lock-keywords '(("^[ ]*--.*" . font-lock-comment-face) ("^ *\\([^ :]+\\):" (1 font-lock-keyword-face)) ("^\\(Library\\)[ ]*\\({\\|$\\)" (1 font-lock-keyword-face)) ("^\\(Executable\\|Test-Suite\\|Benchmark\\|Common\\|package\\)[ ]+\\([^\n ]*\\)" (1 font-lock-keyword-face) (2 font-lock-function-name-face)) ("^\\(Flag\\|install-dirs\\|repository\\)[ ]+\\([^\n ]*\\)" (1 font-lock-keyword-face) (2 font-lock-constant-face)) ("^\\(Source-Repository\\)[ ]+\\(head\\|this\\)" (1 font-lock-keyword-face) (2 font-lock-constant-face)) ("^\\(haddock\\|source-repository-package\\|program-locations\\|program-default-options\\)\\([ ]\\|$\\)" (1 font-lock-keyword-face)) ("^ *\\(if\\)[ ]+.*\\({\\|$\\)" (1 font-lock-keyword-face)) ("^ *\\(}[ ]*\\)?\\(else\\)[ ]*\\({\\|$\\)" (2 font-lock-keyword-face)) ("\\<\\(?:True\\|False\\)\\>" (0 font-lock-constant-face)))) #@24 List of Cabal buffers. (defvar haskell-cabal-buffers nil (#$ . 2421)) #@296 Refresh list of known cabal buffers. Check each buffer in variable `haskell-cabal-buffers' and remove it from list if one of the following conditions are hold: + buffer is killed; + buffer's mode is not derived from `haskell-cabal-mode'; + buffer is a BUFFER (if given). (fn &optional BUFFER) (defalias 'haskell-cabal-buffers-clean #[256 "\301\211\203+\211@\302!\203$\211=\204$r\211q\210\303\304!)\203$\211B\262A\266\202\202\210\211\211\207" [haskell-cabal-buffers nil buffer-live-p derived-mode-p haskell-cabal-mode] 6 (#$ . 2498)]) #@65 Exclude current buffer from global list of known cabal buffers. (defalias 'haskell-cabal-unregister-buffer #[0 "\300p!\207" [haskell-cabal-buffers-clean] 2 (#$ . 3053)]) (add-to-list 'auto-mode-alist '("\\.cabal\\'\\|/cabal\\.project\\|/\\.cabal/config\\'" . haskell-cabal-mode)) (defvar haskell-cabal-mode-map (byte-code "\300 \301\302\303#\210\301\304\305#\210\301\306\307#\210\301\310\311#\210\301\312\313#\210\301\314\311#\210\301\315\313#\210\301\316\317#\210\301\320\321#\210\301\322\323#\210\301\324\325#\210\301\326\327#\210\301\330\331#\210\207" [make-sparse-keymap define-key "" haskell-cabal-subsection-arrange-lines [134217742] haskell-cabal-next-section [134217744] haskell-cabal-previous-section [134217838] haskell-cabal-next-subsection [134217840] haskell-cabal-previous-subsection [C-down] [C-up] "" haskell-cabal-find-or-create-source-file [134217831 108] haskell-cabal-goto-library-section [134217831 101] haskell-cabal-goto-executable-section [134217831 98] haskell-cabal-goto-benchmark-section [134217831 111] haskell-cabal-goto-common-section [134217831 116] haskell-cabal-goto-test-suite-section] 5)) (defvar haskell-cabal-mode-hook nil) (byte-code "\300\301N\204\f\302\300\301\303#\210\304\305!\204\302\305\306\307#\210\300\207" [haskell-cabal-mode-hook variable-documentation put "Hook run after entering Haskell-Cabal mode.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" boundp haskell-cabal-mode-map definition-name haskell-cabal-mode] 4) (defvar haskell-cabal-mode-map (make-sparse-keymap)) (byte-code "\301\302N\204\303\301\302\304\305!#\210\306\307!\204\303\307\310\311#\210\312\313 !\210\307\302N\204-\303\307\302\304\314!#\210\306\300!\204B\303\300\310\311#\210\315\316\300\317\"\210!\210\300\302N\204P\303\300\302\304\320!#\210\303\311\321\317#\207" [haskell-cabal-mode-abbrev-table haskell-cabal-mode-map variable-documentation put purecopy "Keymap for `haskell-cabal-mode'." boundp haskell-cabal-mode-syntax-table definition-name haskell-cabal-mode (lambda (#1=#:def-tmp-var) (defvar haskell-cabal-mode-syntax-table #1#)) make-syntax-table "Syntax table for `haskell-cabal-mode'." (lambda (#1#) (defvar haskell-cabal-mode-abbrev-table #1#)) define-abbrev-table nil "Abbrev table for `haskell-cabal-mode'." derived-mode-parent] 5) #@184 Major mode for Cabal package description files. This mode runs the hook `haskell-cabal-mode-hook', as the final or penultimate step during initialization. \{haskell-cabal-mode-map} (defalias 'haskell-cabal-mode #[0 "\306\300!\210\307\310 \210\311\312\313 !\210\314\f!\210 #\306\315!\210\316 \317\320p\"\210\321\322\323\324\325$\210\321\326\323\324\325$\210\306\327!\210\330\306\331!\210\332\306\333!\210\334\306\335!\210\336\306\337!\210\340\324$)\341\342!\207" [delay-mode-hooks major-mode mode-name haskell-cabal-mode-map haskell-cabal-mode-syntax-table haskell-cabal-mode-abbrev-table make-local-variable t kill-all-local-variables haskell-cabal-mode "Haskell-Cabal" use-local-map set-syntax-table font-lock-defaults (haskell-cabal-font-lock-keywords t t nil nil) add-to-list haskell-cabal-buffers add-hook change-major-mode-hook haskell-cabal-unregister-buffer nil local kill-buffer-hook comment-start "-- " comment-start-skip "\\(^[ ]*\\)--[ ]*" comment-end "" comment-end-skip "[ ]*\\(\\s>\\|\n\\)" indent-line-function haskell-cabal-indent-line run-mode-hooks haskell-cabal-mode-hook local-abbrev-table indent-tabs-mode] 5 (#$ . 5434) nil]) (byte-code "\300\301\302\303#\210\304\301\302\305#\207" [make-obsolete haskell-cabal-get-setting haskell-cabal--get-field "March 14, 2016" defalias "Try to read value of field with NAME from current buffer.\nObsolete function. Defined for backward compatibility. Use\n`haskell-cabal--get-field' instead."] 4) #@70 Try to read value of field with NAME from current buffer. (fn NAME) (defalias 'haskell-cabal--get-field #[257 "\212\301eb\210\302\303\304!\305Q\306\301#\2057\307\310!\310\311\225\2034\312\313#\2034\314\224T\262\315\316\301\211$\262\202\266\202*\207" [case-fold-search t re-search-forward "^[ ]*" regexp-quote ":[ ]*\\(.*\\(\n[ ]+[ \n].*\\)*\\)" nil match-string 1 2 string-match "^[ ]\\(?:\\.$\\)?" 0 replace-match ""] 8 (#$ . 6920)]) (byte-code "\300\301\302\303#\210\304\301\302\305#\207" [make-obsolete haskell-cabal-guess-setting haskell-cabal-get-field "March 14, 2016" defalias "Read the value of field with NAME from project's cabal file.\nObsolete function. Defined for backward compatibility. Use\n`haskell-cabal-get-field' instead."] 4) #@236 Read the value of field with NAME from project's cabal file. If there is no valid .cabal file to get the setting from (or there is no corresponding setting with that name in the .cabal file), then this function returns nil. (fn NAME) (defalias 'haskell-cabal-get-field #[257 "\211\205-\205-\301 \211\205+\302!\205+\303\304\305\"r\211q\210\306\307\"\216\310!\210\311!*\262\262\207" [buffer-file-name haskell-cabal-find-file file-readable-p generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] insert-file-contents haskell-cabal--get-field] 6 (#$ . 7695) nil]) #@154 Get the Cabal dir for a new project. Various ways of figuring this out, and indeed just prompting the user. Do them all. (fn &optional USE-DEFAULTS) (defalias 'haskell-cabal-get-dir #[256 "\301 \211\203\f\302!\202 \203\207\303\304\305\203#\304\306\307!\"\202$\310\"\"\207" [default-directory haskell-cabal-find-file file-name-directory haskell-utils-read-directory-name format "Cabal dir%s: " " (guessed from %s)" file-relative-name ""] 10 (#$ . 8332)]) #@160 Compute MD5 checksum of package description file in DIR. Return nil if no Cabal description file could be located via `haskell-cabal-find-pkg-desc'. (fn DIR) (defalias 'haskell-cabal-compute-checksum #[257 "\300!\211\205\301\302\303\"r\211q\210\304\305\"\216\306!\210\307\310 !*\262\207" [haskell-cabal-find-pkg-desc generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] insert-file-contents md5 buffer-string] 6 (#$ . 8810)]) #@270 Search for package description file upwards starting from DIR. If DIR is nil, `default-directory' is used as starting point for directory traversal. Upward traversal is aborted if file owner changes. Uses `haskell-cabal-find-pkg-desc' internally. (fn &optional DIR) (defalias 'haskell-cabal-find-file #[256 "\211\206\211\203\301!\204\302\303!!\262\202\211\205a\3042a\305\306!8\307!\211\203]\305\306!8\232\203]\310!\211\203C\311\304\"\210\210\302\303!!\211\232\203X\311\304\312\"\266\202)\262\202)\266\3120\207" [default-directory file-directory-p file-name-directory directory-file-name found 2 file-attributes abbreviate-file-name haskell-cabal-find-pkg-desc throw nil] 8 (#$ . 9309)]) #@273 Find a package description file in the directory DIR. Returns nil if none or multiple ".cabal" files were found. If ALLOW-MULTIPLE is non nil, in case of multiple ".cabal" files, a list is returned instead of failing with a nil result. (fn DIR &optional ALLOW-MULTIPLE) (defalias 'haskell-cabal-find-pkg-desc #[513 "\300\301\302\303\304\305\306#\"\"\211G\307U\203\211@\207\203\207\310\207" [cl-remove-if file-directory-p cl-remove-if-not file-exists-p directory-files t ".\\.cabal\\'" 1 nil] 10 (#$ . 10037)]) #@142 Like `haskell-cabal-find-file' but returns directory instead. See `haskell-cabal-find-file' for meaning of DIR argument. (fn &optional DIR) (defalias 'haskell-cabal-find-dir #[256 "\300!\211\205\n\301!\207" [haskell-cabal-find-file file-name-directory] 4 (#$ . 10563)]) #@451 Locate and visit package description file for file visited by current buffer. This uses `haskell-cabal-find-file' to locate the closest ".cabal" file and open it. This command assumes a common Cabal project structure where the ".cabal" file is in the top-folder of the project, and all files related to the project are in or below the top-folder. If called with non-nil prefix argument OTHER-WINDOW use `find-file-other-window'. (fn OTHER-WINDOW) (defalias 'haskell-cabal-visit-file #[257 "\203\301\302!!\211\203\203\303!\207\304!\207\305\306\"\207\305\307!\207" [buffer-file-name haskell-cabal-find-file file-name-directory find-file-other-window find-file error "Could not locate \".cabal\" file for %S" "Cannot locate \".cabal\" file for buffers not visiting any file"] 5 (#$ . 10844) "P"]) (defvar haskell-cabal-commands '("install" "update" "list" "info" "upgrade" "fetch" "unpack" "check" "sdist" "upload" "report" "init" "configure" "build" "copy" "haddock" "clean" "hscolour" "register" "test" "help" "run")) (custom-declare-group 'haskell-cabal nil "Haskell cabal files" :group 'haskell) (defconst haskell-cabal-section-header-regexp "^[[:alnum:]]") (defconst haskell-cabal-subsection-header-regexp "^[ ]*[[:alnum:]]\\w*:") (defconst haskell-cabal-comment-regexp "^[ ]*--") (defconst haskell-cabal-empty-regexp "^[ ]*$") (defconst haskell-cabal-conditional-regexp "^[ ]*\\(\\if\\|else\\|}\\)") #@103 Classify the current line into 'section-header 'subsection-header 'section-data 'comment and 'empty ' (defalias 'haskell-cabal-classify-line #[0 "\212\305 \210\306!\203\307\2027\306 !\203\310\2027\306\n!\203\"\311\2027\306 !\203,\312\2027\306\f!\2036\313\2027\314)\207" [haskell-cabal-subsection-header-regexp haskell-cabal-section-header-regexp haskell-cabal-comment-regexp haskell-cabal-empty-regexp haskell-cabal-conditional-regexp beginning-of-line looking-at subsection-header section-header comment empty conditional section-data] 2 (#$ . 12273)]) #@53 Is the current line a section or subsection header? (defalias 'haskell-cabal-header-p #[0 "\300 \211\301>\205 \302\207" [haskell-cabal-classify-line (section-header subsection-header) t] 3 (#$ . 12846)]) #@53 Is the current line a section or subsection header? (defalias 'haskell-cabal-section-header-p #[0 "\300 \211\301=\205 \302\207" [haskell-cabal-classify-line section-header t] 3 (#$ . 13057)]) #@43 Find the beginning of the current section (defalias 'haskell-cabal-section-beginning #[0 "\212o\204\300 \204\301y\210\202`)\207" [haskell-cabal-section-header-p -1] 1 (#$ . 13256)]) #@36 go to the beginning of the section (defalias 'haskell-cabal-beginning-of-section #[0 "\300 b\207" [haskell-cabal-section-beginning] 1 (#$ . 13450) nil]) #@37 Find the end of the current section (defalias 'haskell-cabal-section-end #[0 "\212\300\301\302\303#\203\304\224\202d)\207" [re-search-forward "\n\\([ ]*\n\\)*[[:alnum:]]" nil t 0] 4 (#$ . 13609) nil]) #@30 go to the end of the section (defalias 'haskell-cabal-end-of-section #[0 "\300 b\207" [haskell-cabal-section-end] 1 (#$ . 13821) nil]) #@24 Go to the next section (defalias 'haskell-cabal-next-section #[0 "\300 \203\301y\210m\206\300 ?\205\301y\210\202\207" [haskell-cabal-section-header-p nil] 1 (#$ . 13962) nil]) #@24 Go to the next section (defalias 'haskell-cabal-previous-section #[0 "\300 \203\301y\210o\206\300 ?\205\301y\210\202\207" [haskell-cabal-section-header-p -1] 1 (#$ . 14152) nil]) #@40 find the end of the current subsection (defalias 'haskell-cabal-subsection-end #[0 "\212\300 \210\301y\210m\204\302 \303>\203\301y\210\202m\204\304y\210\302 \305=\2030o\2040\304y\210\202\301\210`)\207" [haskell-cabal-beginning-of-subsection nil haskell-cabal-classify-line (empty section-data) -1 empty] 2 (#$ . 14345)]) #@41 go to the end of the current subsection (defalias 'haskell-cabal-end-of-subsection #[0 "\300 b\207" [haskell-cabal-subsection-end] 1 (#$ . 14685) nil]) #@49 Get the name and data of the associated section (defalias 'haskell-cabal-section #[0 "\212\300 \210\301 \205\302\303!\205\304\305\306!\307\305\310!\311\312\224\313\314 \257)\207" [haskell-cabal-beginning-of-section haskell-cabal-section-header-p looking-at "^\\(\\w+\\)[ ]*\\(.*\\)$" :name match-string-no-properties 1 :value 2 :beginning 0 :end haskell-cabal-section-end] 8 (#$ . 14843)]) #@54 Get the name and bounds of of the current subsection (defalias 'haskell-cabal-subsection #[0 "\212\300 \210\301\302!\205:\303\304\305!\306\307\225\310\311 \312\313\"\216\314 )\262\315\212\307\225b\210i)\316\212\307\225b\210\301\317!\2036\320\224b\210i)\257\n)\207" [haskell-cabal-beginning-of-subsection looking-at "\\([ ]*\\(\\w*\\):\\)[ ]*" :name match-string-no-properties 2 :beginning 0 :end match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] haskell-cabal-subsection-end :data-start-column :data-indent-column "\n +\\(\\w*\\)" 1] 11 (#$ . 15245)]) #@16 (fn SECTION) (defalias 'haskell-cabal-section-name #[257 "\300\301\"\207" [plist-get :name] 4 (#$ . 15842)]) #@16 (fn SECTION) (defalias 'haskell-cabal-section-value #[257 "\300\301\"\207" [plist-get :value] 4 (#$ . 15960)]) #@16 (fn SECTION) (defalias 'haskell-cabal-section-start #[257 "\300\301\"\207" [plist-get :beginning] 4 (#$ . 16080)]) #@16 (fn SECTION) (defalias 'haskell-cabal-section-data-start-column #[257 "\300\301\"\207" [plist-get :data-start-column] 4 (#$ . 16204)]) #@16 (fn SECTION) (defalias 'haskell-cabal-section-data-indent-column #[257 "\300\301\"\207" [plist-get :data-indent-column] 4 (#$ . 16348)]) #@90 Map from cabal file COMPONENT-TYPE to build command component-type. (fn COMPONENT-TYPE) (defalias 'haskell-cabal-map-component-type #[257 "\211\227\211\300\267\202\301\207\302\207\303\207\304\207" [#s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 purecopy t data ("executable" 8 "test-suite" 10 "benchmark" 12)) "exe" "test" "bench" nil] 4 (#$ . 16494)]) #@115 Enumerate .cabal targets. PROCESS-TYPE determines the format of the returned target. (fn &optional PROCESS-TYPE) (defalias 'haskell-cabal-enum-targets #[256 "\300 \203\n\202 \301\205\217\302!\205\217\303\304\305\"r\211q\210\306\307\"\216\310!\210\311 \210eb\210\312\313\314!\315 \210m\204\207\316\317 !\203\201\317 \320!\321\322!!@\227\323\232\203k\324=\203]\325P\202`\326P\211B\262\266\202\201\324=\205u\327P\330!\327RB\262\266\315 \210\2023\331!\266\202*\262\207" [haskell-cabal-find-file ghci file-readable-p generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] insert-file-contents haskell-cabal-mode nil haskell-cabal--get-field "name" haskell-cabal-next-section haskell-cabal-source-section-p haskell-cabal-section haskell-cabal-section-name split-string haskell-cabal-section-value "library" stack-ghci ":lib" "lib:" ":" haskell-cabal-map-component-type reverse] 13 (#$ . 16882)]) #@207 Copy subsection data into a temporary buffer, save indentation and execute FORMS If REPLACE is non-nil the subsection data is replaced with the resulting buffer-content (fn SUBSECTION REPLACE &rest FUNS) (defalias 'haskell-cabal-with-subsection '(macro . #[642 "\300\301!\300\302!\300\303!\300\304!\300\305!\306 D\307\310BBD\307 \311BBD\307\n\312BBD\313\n\nED\257\314\315\316\317\320D\321D\322\315\323\324BD\325\326\327\330\331\332DED\333BB\334\335BB\257\257 \205v\336  E\337\nD\321DEBBDE\207" [make-symbol "section" "beg" "end" "start-col" "section-data" let* plist-get (:beginning) (:end) (:data-start-column) buffer-substring save-excursion prog1 with-temp-buffer (setq indent-tabs-mode nil) indent-to insert (goto-char (point-min)) progn haskell-cabal-save-indentation (goto-char (point-min)) when looking-at format "[ ]\\{0,%d\\}" 1+ ((replace-match "")) setq ((buffer-substring (point-min) (point-max))) delete-region goto-char] 26 (#$ . 17876)])) #@44 Execute FORMS on each line (fn &rest FUN) (defalias 'haskell-cabal-each-line '(macro . #[128 "\300\301\302\303\304\"BBD\207" [save-excursion while (< (point) (point-max)) append ((forward-line))] 7 (#$ . 18870)])) #@59 Remove leading and trailing whitespaces from current line (defalias 'haskell-cabal-chomp-line #[0 "\300 \210\301\302!\205\303\304\305!\306\307#\210\307\207" [beginning-of-line looking-at "^[ ]*\\([^ ]\\|\\(?:[^ ].*[^ ]\\)\\)[ ]*$" replace-match match-string 1 nil t] 4 (#$ . 19092)]) #@102 Compute largest common whitespace prefix of each line in between BEG and END (fn &optional BEG END) (defalias 'haskell-cabal-min-indentation #[512 "\212\206eb\210\300`\206dW\203.\301 \302 \204'\203$\211W\203'\211\262\210\300y\210\202 \211\262)\207" [nil current-indentation haskell-cabal-ignore-line-p] 6 (#$ . 19390)]) #@50 Does line only contain whitespaces and comments? (defalias 'haskell-cabal-ignore-line-p #[0 "\212\300 \210\301\302!)\207" [beginning-of-line looking-at "^[ ]*\\(?:--.*\\)?$"] 2 (#$ . 19732)]) #@56 Remove longest common whitespace prefix from each line (defalias 'haskell-cabal-kill-indentation #[0 "eb\210\300 \212`dW\203\301 \204\302!\210\303y\210\202)\207" [haskell-cabal-min-indentation haskell-cabal-ignore-line-p delete-char nil] 3 (#$ . 19931)]) #@15 (fn INDENT) (defalias 'haskell-cabal-add-indentation #[257 "eb\210\212`dW\205\300 \204\211j\210\301y\210\202)\207" [haskell-cabal-ignore-line-p nil] 3 (#$ . 20199)]) #@145 Strip indentation from each line, execute FORMS and reinstate indentation so that the indentation of the FIRST LINE matches (fn &rest FUNS) (defalias 'haskell-cabal-save-indentation '(macro . #[128 "\300\301!\300\302!\303\304BC\305\306\307BB\306\310\303\311BC\312\313  EDEEEE\207" [make-symbol "new-l1-indent" "old-l1-indent" let ((save-excursion (goto-char (point-min)) (current-indentation))) unwind-protect progn (haskell-cabal-kill-indentation) (goto-char (point-min)) ((current-indentation)) haskell-cabal-add-indentation -] 15 (#$ . 20380)])) #@167 Return non-nil when the char at POS is a comma separator. Characters that are not a comma, or commas inside a commment or string, are not comma separators. (fn POS) (defalias 'haskell-cabal-comma-separatorp #[257 "\211f\300=\205\301!\3028\206\3038?\262\207" [44 syntax-ppss 3 4] 4 (#$ . 20947)]) #@521 Strip commas from a comma-separated list. Detect and return the comma style. The possible options are: before: a comma at the start of each line (except the first), e.g. Foo , Bar after: a comma at the end of each line (except the last), e.g. Foo, Bar single: everything on a single line, but comma-separated, e.g. Foo, Bar nil: no commas, e.g. Foo Bar If the styles are mixed, the position of the first comma determines the style. If there is only one element then `after' style is assumed. (defalias 'haskell-cabal-strip-list-and-detect-style #[0 "\300eb\210\301\302\300\303#\203\304\305\224!\203\306\262\307\310\300\211#\210\202eb\210\301\311\300\303#\2036\312\262\307\313\300\211#\210\202\"eb\210\301\314\300\303#\203S\211\312=\204J\315\262\307\313\300\211#\210\2029\211\204deb\210\300y\210m\203d\315\262eb\210\212`dW\203w\316 \210\300y\210\202h)\207" [nil re-search-forward "\\([^ ,\n]\\)[ ]*\\(,\\)[ ]*\\([^ ,\n]\\)" t haskell-cabal-comma-separatorp 2 single replace-match "\\1\n\\3" "^\\([ ]*\\),\\([ ]*\\)" before "" ",[ ]*$" after haskell-cabal-chomp-line] 5 (#$ . 21259)]) #@180 Add commas so that the buffer contains a comma-separated list. Respect the COMMA-STYLE, see `haskell-cabal-strip-list-and-detect-style' for the possible styles. (fn COMMA-STYLE) (defalias 'haskell-cabal-listify #[257 "\211\300\267\202jeb\210\301 \203\302y\210\202 \303j\210\302y\210\212`dW\205/\301 \204)\304c\210\302y\210\202)\207db\210\305y\306=\205k\301 \2044\302\210\307c\210\310 \210\2024\207eb\210m?\205k\302\210m\204P\304c\210\311\312!\210\313 \210\202P\207\302\207" [#s(hash-table size 4 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (quote 6 before 6 after 49 single 77)) haskell-cabal-ignore-line-p nil 2 ", " -1 0 "," beginning-of-line delete-char 1 just-one-space] 3 (#$ . 22403)]) #@104 Format the buffer so that each line contains a list element. Respect the comma style. (fn &rest FUNS) (defalias 'haskell-cabal-with-cs-list '(macro . #[128 "\300\301!\302\303BC\304\305B\306DEE\207" [make-symbol "comma-style" let ((save-excursion (haskell-cabal-strip-list-and-detect-style))) unwind-protect progn haskell-cabal-listify] 8 (#$ . 23139)])) (defalias 'haskell-cabal-sort-lines-key-fun #[0 "\300\301!\203\n\302\225b\210\303\207" [looking-at "[ ]*--[ ,]*" 0 nil] 2]) #@76 Save position as mark, execute FORMs and go back to mark (fn &rest FORMS) (defalias 'haskell-cabal-save-position '(macro . #[128 "\300\301\302B\303BBB\207" [prog2 (haskell-cabal-mark) progn ((haskell-cabal-goto-mark) (haskell-cabal-remove-mark))] 5 (#$ . 23630)])) #@18 (fn KEY1 KEY2) (defalias 'haskell-cabal-sort-lines-depends-compare #[514 "@A{@A{\300\301\"\203\302\207\300\301\"\203\303\207\231\207" [string-match "^[ ]*base\\($\\|[^[:alnum:]-]\\)" t nil] 7 (#$ . 23903)]) #@34 Sort lines of current subsection (defalias 'haskell-cabal-subsection-arrange-lines #[0 "\301 \210\302\303 !\211\227\304\230\205\305\303 \306\307\"\306\310\"\306\311\"{\212\312\313\314\"r\211q\210\315\316\"\216\317j\210c\210eb\210\212eb\210\320 )\315\321\"\216\322 \210\212\323 )\315\324\"\216\325\317\326\327\330\327&)\262)\262eb\210\331\332\333T\"!\203s\334\335!\210ed{\262*\262|\210b\210c\210)\266\207\336 \210\337 \210\207" [indent-tabs-mode haskell-cabal-mark haskell-cabal-section-name haskell-cabal-subsection "build-depends" haskell-cabal-sort-lines-depends-compare plist-get :beginning :end :data-start-column generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] nil current-indentation #[0 "eb\210\301 \302\300Z!\207" [V0 current-indentation haskell-cabal-add-indentation] 4] haskell-cabal-kill-indentation haskell-cabal-strip-list-and-detect-style #[0 "\301\300!\207" [V0 haskell-cabal-listify] 2] sort-subr forward-line end-of-line haskell-cabal-sort-lines-key-fun looking-at format "[ ]\\{0,%d\\}" replace-match "" haskell-cabal-goto-mark haskell-cabal-remove-mark] 17 (#$ . 24131) nil]) #@46 find the beginning of the current subsection (defalias 'haskell-cabal-subsection-beginning #[0 "\212o\204\300 \204\301y\210\202\302 \210`)\207" [haskell-cabal-header-p -1 back-to-indentation] 1 (#$ . 25324)]) #@47 go to the beginning of the current subsection (defalias 'haskell-cabal-beginning-of-subsection #[0 "\300 b\207" [haskell-cabal-subsection-beginning] 1 (#$ . 25545) nil]) #@27 go to the next subsection (defalias 'haskell-cabal-next-subsection #[0 "\300 \203\301y\210m\204\300 \204\301y\210\202\302 \207" [haskell-cabal-header-p nil haskell-cabal-forward-to-line-entry] 1 (#$ . 25721) nil]) #@31 go to the previous subsection (defalias 'haskell-cabal-previous-subsection #[0 "\300 \203\301y\210o\204\300 \204\301y\210\202\302 \207" [haskell-cabal-header-p -1 haskell-cabal-forward-to-line-entry] 1 (#$ . 25949) nil]) #@51 Find subsection with name NAME (fn SECTION PRED) (defalias 'haskell-cabal-find-subsection-by #[514 "\212\203\n\300!b\210\203\301 \202d\302`W\2035\211\2045\303 \211\203.!\203.\211\262\210\304 \210\202\262)\207" [haskell-cabal-section-start haskell-cabal-section-end nil haskell-cabal-subsection haskell-cabal-next-subsection] 7 (#$ . 26184)]) #@51 Find subsection with name NAME (fn SECTION NAME) (defalias 'haskell-cabal-find-subsection #[514 "\211\227\300\301\302\303\304EE\"\207" [haskell-cabal-find-subsection-by lambda (subsection) string= (downcase (haskell-cabal-section-name subsection))] 10 (#$ . 26552)]) #@13 (fn NAME) (defalias 'haskell-cabal-goto-subsection #[257 "\300\301 \"\211\205 \302!b\207" [haskell-cabal-find-subsection haskell-cabal-section haskell-cabal-section-start] 4 (#$ . 26829)]) (defalias 'haskell-cabal-goto-exposed-modules #[0 "\300\301!\207" [haskell-cabal-goto-subsection "exposed-modules"] 2 nil nil]) #@59 Get the data of a subsection as a list (fn SECTION NAME) (defalias 'haskell-cabal-subsection-entry-list #[514 "\303\"\211\205~\211\304\305\"\304\306\"\304\307\"{\212\310\311\312\"r\211q\210\313\314\"\216\315j\210c\210eb\210\212eb\210\316 )\313\317\"\216\320 \210\212\321 )\313\322\"\216\323\324\325 \n#ed#\210\326\327ed\"\330\312#)\262)\262eb\210\331\324\332T\"!\203s\333\334!\210ed{\262*\262)\266\205\207" [indent-tabs-mode haskell-cabal-comment-regexp haskell-cabal-empty-regexp haskell-cabal-find-subsection plist-get :beginning :end :data-start-column generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] nil current-indentation #[0 "eb\210\301 \302\300Z!\207" [V0 current-indentation haskell-cabal-add-indentation] 4] haskell-cabal-kill-indentation haskell-cabal-strip-list-and-detect-style #[0 "\301\300!\207" [V0 haskell-cabal-listify] 2] delete-matching-lines format "\\(?:%s\\)\\|\\(?:%s\\)" split-string buffer-substring-no-properties "\n" looking-at "[ ]\\{0,%d\\}" replace-match ""] 16 (#$ . 27157)]) (defalias 'haskell-cabal-remove-mark #[0 "\300ed\301#\207" [remove-list-of-text-properties (haskell-cabal-marker)] 4]) #@71 Mark the current position with the text property haskell-cabal-marker (defalias 'haskell-cabal-mark #[0 "\300 \210\301\302 \303 \304\305$\210\301``T\304\306$\207" [haskell-cabal-remove-mark put-text-property line-beginning-position line-end-position haskell-cabal-marker marked-line marked] 5 (#$ . 28377)]) #@19 Go to marked line (defalias 'haskell-cabal-goto-mark #[0 "\300ed\301\302$\300ed\301\303$\203b\207\211\205\211b\207" [text-property-any haskell-cabal-marker marked marked-line] 6 (#$ . 28691)]) #@254 Mark line, copy subsection data into a temporary buffer, save indentation and execute FORMS at the marked line. If REPLACE is non-nil the subsection data is replaced with the resulting buffer-content. Unmark line at the end. (fn REPLACE &rest FORMS) (defalias 'haskell-cabal-with-subsection-line '(macro . #[385 "\300\301\302\303\304\305BBBB\306BBE\207" [progn (haskell-cabal-mark) unwind-protect haskell-cabal-with-subsection (haskell-cabal-subsection) (haskell-cabal-goto-mark) ((haskell-cabal-remove-mark))] 10 (#$ . 28897)])) (defalias 'haskell-cabal-get-line-content #[0 "\301 \210\302\216\303 \304\305\"\304\306\"\304\307\"{\212\310\311\312\"r\211q\210\313\314\"\216\315j\210c\210eb\210\212eb\210\316 )\313\317\"\216\320 \210\321 \210\212\322 )\313\323\"\216\321 \210\324\325 \326 \")\262)\262eb\210\327\330\331T\"!\203k\332\333!\210ed{\262*\262)\266\205)\207" [indent-tabs-mode haskell-cabal-mark #[0 "\300 \207" [haskell-cabal-remove-mark] 1] haskell-cabal-subsection plist-get :beginning :end :data-start-column generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] nil current-indentation #[0 "eb\210\301 \302\300Z!\207" [V0 current-indentation haskell-cabal-add-indentation] 4] haskell-cabal-kill-indentation haskell-cabal-goto-mark haskell-cabal-strip-list-and-detect-style #[0 "\301\300!\207" [V0 haskell-cabal-listify] 2] buffer-substring-no-properties line-beginning-position line-end-position looking-at format "[ ]\\{0,%d\\}" replace-match ""] 11]) #@15 (fn MODULE) (defalias 'haskell-cabal-module-to-filename #[257 "\300\301\302#\303P\207" [replace-regexp-in-string "[.]" "/" ".hs"] 5 (#$ . 30453)]) #@44 List of sections that contain module names (defconst haskell-cabal-module-sections '("exposed-modules" "other-modules") (#$ . 30609)) #@44 List of subsections that contain filenames (defconst haskell-cabal-file-sections '("main-is" "c-sources" "data-files" "extra-source-files" "extra-doc-files" "extra-tmp-files") (#$ . 30749)) (defconst haskell-cabal-source-bearing-sections '("library" "executable" "test-suite" "benchmark")) #@16 (fn SECTION) (defalias 'haskell-cabal-source-section-p #[257 "\301!\227\235??\207" [haskell-cabal-source-bearing-sections haskell-cabal-section-name] 3 (#$ . 31045)]) #@334 Expand filename in current line according to the subsection type Module names in exposed-modules and other-modules are expanded by replacing each dot (.) in the module name with a forward slash (/) and appending ".hs" Example: Foo.Bar.Quux ==> Foo/Bar/Quux.hs Source names from main-is and c-sources sections are left untouched  (defalias 'haskell-cabal-line-filename #[0 "\302 \303\304 !\227\211\235\203\305!\207\211 \235\205\207" [haskell-cabal-module-sections haskell-cabal-file-sections haskell-cabal-get-line-content haskell-cabal-section-name haskell-cabal-subsection haskell-cabal-module-to-filename] 4 (#$ . 31223)]) #@47 Crude hack to replace f-join (fn &rest ARGS) (defalias 'haskell-cabal-join-paths #[128 "\300\301\302#\207" [mapconcat identity "/"] 5 (#$ . 31865)]) #@43 Open the source file this line refers to. (defalias 'haskell-cabal-find-or-create-source-file #[0 "\300\301\302 \303\"\304\"\305\306 !\307 \211\205O\310\311\312\313\314#\"\"\211\204I\315\216\316 \210\317@\2061\320\"\317\"\321\322\323\"!\211\205C\324!\266\203)\202M\324@!\262\207" [append haskell-cabal-subsection-entry-list haskell-cabal-section "hs-source-dirs" (#1="") file-name-directory buffer-file-name haskell-cabal-line-filename delq nil mapcar make-closure #[257 "\302\300\301#\303!\205\304!?\205\211\207" [V0 V1 haskell-cabal-join-paths file-readable-p file-directory-p] 5 "\n\n(fn DIR)"] #[0 "\300\301!\207" [haskell-mode-toggle-interactive-prompt-state t] 2] haskell-mode-toggle-interactive-prompt-state haskell-cabal-join-paths #1# y-or-n-p format "Create file %s ?" find-file-other-window] 10 (#$ . 32022) nil]) #@28 (fn TYPE &optional WRAP) (defalias 'haskell-cabal-find-section-type #[513 "\212\300 \210m\204\227\301\302 !\227\230\204\300 \210\202m\203+\211\205,eb\210\303\304\"\202,`)\207" [haskell-cabal-next-section haskell-cabal-section-name haskell-cabal-section haskell-cabal-find-section-type nil] 5 (#$ . 32879)]) #@13 (fn TYPE) (defalias 'haskell-cabal-goto-section-type #[257 "\300\301\"\211\203 \211b\207\302\303\"\207" [haskell-cabal-find-section-type t message "No %s section found"] 5 (#$ . 33205)]) (defalias 'haskell-cabal-goto-library-section #[0 "\300\301!\207" [haskell-cabal-goto-section-type "library"] 2 nil nil]) (defalias 'haskell-cabal-goto-test-suite-section #[0 "\300\301!\207" [haskell-cabal-goto-section-type "test-suite"] 2 nil nil]) (defalias 'haskell-cabal-goto-executable-section #[0 "\300\301!\207" [haskell-cabal-goto-section-type "executable"] 2 nil nil]) (defalias 'haskell-cabal-goto-benchmark-section #[0 "\300\301!\207" [haskell-cabal-goto-section-type "benchmark"] 2 nil nil]) (defalias 'haskell-cabal-goto-common-section #[0 "\300\301!\207" [haskell-cabal-goto-section-type "common"] 2 nil nil]) #@39 Column at which the line entry starts (defalias 'haskell-cabal-line-entry-column #[0 "\212\300 \211\301\267\202!\302 \210\303\304!\205\"\305\225b\210i\202\"\306\307 !\202\"\310\262)\207" [haskell-cabal-classify-line #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (section-data 9 subsection-header 26)) beginning-of-line looking-at "[ ]*\\(?:,[ ]*\\)?" 0 haskell-cabal-section-data-start-column haskell-cabal-subsection nil] 3 (#$ . 34027)]) #@74 go forward to the beginning of the line entry (but never move backwards) (defalias 'haskell-cabal-forward-to-line-entry #[0 "\300 \211\205iW\205\301 \210\211u\207" [haskell-cabal-line-entry-column beginning-of-line] 3 (#$ . 34517)]) #@45 Indent current line according to subsection (defalias 'haskell-cabal-indent-line #[0 "\300 \211\301\267\210\2021\212\302\303 !\304!\210\305 \210\306\307!\203#\310\311\312\211\313\314%\210\210)\210\2021\315 \266\2021\210\316 \207" [haskell-cabal-classify-line #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (section-data 9 empty 41)) haskell-cabal-section-data-indent-column haskell-cabal-subsection indent-line-to beginning-of-line looking-at "[ ]*\\([ ]\\{2\\},[ ]*\\)" replace-match ", " t nil 1 indent-relative haskell-cabal-forward-to-line-entry] 8 (#$ . 34761) nil]) #@64 Execute fun over each section, collecting the result (fn FUN) (defalias 'haskell-cabal-map-sections #[257 "\212eb\210\300m\204$\301 \211\205\301 !\203\211B\262\266\302 \210\202\211\237\262)\207" [nil haskell-cabal-section haskell-cabal-next-section] 6 (#$ . 35383)]) #@89 Add a build dependency to the build-depends section (fn DEPENDENCY &optional SORT SEC) (defalias 'haskell-cabal-section-add-build-dependency #[769 "\211\206\301 \211\205\302\303\"\211\205\225\211\304\305\"\304\306\"\304\307\"{\212\310\311\312\"r\211q\210\313\314\"\216\315j\210c\210eb\210\212eb\210\316 )\313\317\"\216\320 \210\212\321 )\313\322\"\216\fc\210\323c\210 \205heb\210\324\315\325\326\327$)\262)\262eb\210\330\331\332T\"!\203\200\333\334!\210ed{\262*\262|\210b\210c\210)\266\205\207" [indent-tabs-mode haskell-cabal-section haskell-cabal-find-subsection "build-depends" plist-get :beginning :end :data-start-column generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] nil current-indentation #[0 "eb\210\301 \302\300Z!\207" [V0 current-indentation haskell-cabal-add-indentation] 4] haskell-cabal-kill-indentation haskell-cabal-strip-list-and-detect-style #[0 "\301\300!\207" [V0 haskell-cabal-listify] 2] "\n" sort-subr forward-line end-of-line haskell-cabal-sort-lines-key-fun looking-at format "[ ]\\{0,%d\\}" replace-match ""] 18 (#$ . 35670)]) #@231 Add the given DEPENDENCY to every section in cabal file. If SORT argument is given sort dependencies in section after update. Pass SILENT argument to update all sections without asking user. (fn DEPENDENCY &optional SORT SILENT) (defalias 'haskell-cabal-add-build-dependency #[769 "\300\301\302$!\207" [haskell-cabal-map-sections make-closure #[257 "\303!\205$\304\216\302\204\305\306\307\300\310!\311!$!\203\"\312\300\301#\210)\313\207" [V0 V1 V2 haskell-cabal-source-section-p #[0 "\300\301!\207" [haskell-mode-toggle-interactive-prompt-state t] 2] y-or-n-p format "Add dependency %s to %s section %s?" haskell-cabal-section-name haskell-cabal-section-value haskell-cabal-section-add-build-dependency nil] 8 "\n\n(fn SECTION)"]] 9 (#$ . 36828)]) #@360 Add PACKAGE to the cabal file. If VERSION is non-nil it will be appended as a minimum version. If NO-PROMPT is nil the minimum package version is read from the minibuffer. When SORT is non-nil the package entries are sorted afterwards. If SILENT is non-nil the user is prompted for each source-section. (fn PACKAGE &optional VERSION NO-PROMPT SORT SILENT) (defalias 'haskell-cabal-add-dependency #[1281 "\300 \210\301\216\302 \303\304\"\216\305\306 !\210\203\202,\307\310\203)\311P\202*\312P\"\313#\210\204<\314\315!\205>\316 \262)\262)\207" [haskell-mode-toggle-interactive-prompt-state #[0 "\300\301!\207" [haskell-mode-toggle-interactive-prompt-state t] 2] current-window-configuration make-closure #[0 "\301\300!\207" [V0 set-window-configuration] 2] find-file-other-window haskell-cabal-find-file read-from-minibuffer "Package entry: " " >= " "" haskell-cabal-add-build-dependency y-or-n-p "Save cabal file? " save-buffer] 11 (#$ . 37596) (byte-code "\300\301!\302\303\211\302\257\207" [read-from-minibuffer "Package entry: " nil t] 5)]) #@226 Return a directory where TAGS file will be generated. Tries to find cabal file first and if succeeds uses its location. If cabal file not found uses current file directory. If current buffer not visiting a file returns nil. (defalias 'haskell-cabal--find-tags-dir #[0 "\301 \206\f\205\f\302!\207" [buffer-file-name haskell-cabal-find-dir file-name-directory] 2 (#$ . 38672)]) #@620 Prepare command to execute `hasktags` command in DIR folder. To customise the command executed, see `haskell-hasktags-path' and `haskell-hasktags-arguments'. This function takes into account the user's operating system: in case of Windows it generates a simple command, relying on Hasktags itself to find source files: hasktags --output=DIRTAGS -x -e DIR In other cases it uses `find` command to find all source files recursively avoiding visiting unnecessary heavy directories like .git, .svn, _darcs and build directories created by cabal-install, stack, etc and passes list of found files to Hasktags. (fn DIR) (defalias 'haskell-cabal--compose-hasktags-command #[257 "\303=\203\304\305 \306\307\310\"!\311\312\n\313#\306!%\207\304\314\306!\315\304\316\306 !\311\312\n\313##$\207" [system-type haskell-hasktags-path haskell-hasktags-arguments windows-nt format "%s --output=%s %s %s" shell-quote-argument expand-file-name "TAGS" mapconcat identity " " "cd %s && %s | %s" "find . -type d \\( -name .git -o -name .svn -o -name _darcs -o -name .stack-work -o -name dist -o -name dist-newstyle -o -name .cabal-sandbox \\) -prune -o -type f \\( -name '*.hs' -or -name '*.lhs' -or -name '*.hsc' \\) -not \\( -name '#*' -or -name '.*' \\) -print0" "xargs -0 %s %s"] 12 (#$ . 39060)]) (provide 'haskell-cabal)