;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\303\304!\210\303\305\306\"\210\205\307!\310\311\312\313\314\315\312\315\316\317\320\321\322& #\315\207" [load-file-name sly-package-fu--path sly-package-fu--contrib require sly sly-parse "lib/sly-parse" file-name-directory put sly-contribs sly-package-fu record sly-contrib nil (slynk/package-fu) sly-package-fu-init sly-package-fu-unload ("Tobias C. Rittweiler ") ("GPL")] 13) (defalias 'sly-package-fu-init #[0 "\306\307\310\311\312\313\314\"\"\"\210\315\314:\203'@\262\316\317E \320\321$A\262\202 \266\n\322=\2037\323 \2037\324 \210\325 \326\327#\210\325 \330\331#\210\332\f! >\204R\333\334\335\fD\"\210\f\211\336\337I\207" [sly-package-fu--path sly-contrib--required-slynk-modules this-command sly-mode-map sly-package-fu--contrib cl-struct-sly-contrib-tags mapc funcall mapcar sly-contrib--enable cl-remove-if sly-contrib--enabled-p nil (slynk/package-fu) cl-adjoin sly-package-fu :key cl-first sly-setup sly-connected-p sly-contrib--load-slynk-dependencies define-key "x" sly-export-symbol-at-point "i" sly-import-symbol-at-point type-of signal wrong-type-argument sly-contrib 1 t] 7]) (defalias 'sly-package-fu-unload #[0 "\303\304:\203@\262\305\306\307$A\262\202\266\310\311\312\"\210\313\314\315\316\317\320\304\"\"\"\210\321 !\n>\204:\322\323\324 D\"\210 \211\325\304I\207" [sly-contrib--required-slynk-modules sly-package-fu--contrib cl-struct-sly-contrib-tags (slynk/package-fu) nil cl-remove :key cl-first sly-warning "Disabling contrib %s" sly-package-fu mapc funcall mapcar sly-contrib--disable cl-remove-if-not sly-contrib--enabled-p type-of signal wrong-type-argument sly-contrib 1] 7]) (defvar sly-package-file-candidates (mapcar 'file-name-nondirectory '("package.lisp" "packages.lisp" "pkgdcl.lisp" "defpackage.lisp"))) (defvar sly-export-symbol-representation-function #[257 "\300\301\"\207" [format "#:%s"] 4 "\n\n(fn N)"]) #@343 String transformation used by `sly-import-symbol-at-point'. This function is applied to a package name before it is inserted into the defpackage form. By default, it is `identity' but you may wish redefine it to do some tranformations, for example, to replace dots with slashes to conform to a package-inferred ASDF system-definition style. (defvar sly-import-symbol-package-transform-function 'identity (#$ . 2001)) #@164 Determine automatically which style is used for symbols, #: or : If it's mixed or no symbols are exported so far, use `sly-export-symbol-representation-function'. (defvar sly-export-symbol-representation-auto t (#$ . 2426)) (byte-code "\300\301\302\303#\210\304\211\203(\211@\301N\203!\302N\204!\305\302\301N#\210A\266\202\202\210\306\301\302\307#\207" [defvaralias sly-export-save-file sly-package-fu-save-file nil (saved-value saved-variable-comment) put make-obsolete-variable "1.0.0-beta-3"] 7) #@57 Save the package file after each automatic modification (defvar sly-package-fu-save-file nil (#$ . 2941)) (defvar sly-defpackage-regexp "^(\\(cl:\\|common-lisp:\\|uiop:\\|\\uiop/package:\\)?\\(defpackage\\|define-package\\)\\>[ ']*") (put 'uiop:define-package 'sly-common-lisp-indent-function '(as defpackage)) #@16 (fn PACKAGE) (defalias 'sly-find-package-definition-rpc #[257 "\300\301\302DD!\207" [sly-eval slynk:find-definition-for-thing slynk::guess-package] 5 (#$ . 3259)]) #@16 (fn PACKAGE) (defalias 'sly-find-package-definition-regexp #[257 "\212\301 \302\303\"\216eb\210\30420\305\306\307#\205/\310\311 \"\203\312 \210\313\304\314\315 `S\"\"\210\2020)\262)\207" [sly-defpackage-regexp match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] --cl-block-nil-- re-search-forward nil t sly-package-equal sly-sexp-at-point backward-sexp throw make-sly-file-location buffer-file-name] 7 (#$ . 3432)]) #@32 (fn DESIGNATOR1 DESIGNATOR2) (defalias 'sly-package-equal #[514 "\300\301!\301!\"\206\302\303E!\207" [cl-equalp sly-cl-symbol-name sly-eval slynk:package=] 6 (#$ . 3896)]) #@74 Unexport `symbol' from `package' in the Lisp image. (fn SYMBOL PACKAGE) (defalias 'sly-export-symbol #[514 "\300\301E!\207" [sly-eval slynk:export-symbol-for-emacs] 6 (#$ . 4082)]) #@72 Export `symbol' from `package' in the Lisp image. (fn SYMBOL PACKAGE) (defalias 'sly-unexport-symbol #[514 "\300\301E!\207" [sly-eval slynk:unexport-symbol-for-emacs] 6 (#$ . 4272)]) #@25 (fn BUFFER-FILE-NAME) (defalias 'sly-find-possible-package-file #[257 "\300\301\205 \302!!\206!!\206\211!!!\262\207" [#[257 "\300\301\302!!\301\303!P!\207" [expand-file-name file-name-as-directory sly-to-lisp-filename ".."] 5 "\n\n(fn DIRNAME)"] #[257 "\3012&\211\205#\211@\302P!\303!\203\304\301\"\210\210A\266\202\202\2620\207" [sly-package-file-candidates --cl-block-nil-- sly-to-lisp-filename file-readable-p throw] 7 "\n\n(fn DIRNAME)"] file-name-directory] 8 (#$ . 4464)]) #@128 Tries to find the DEFPACKAGE form of `package'. If found, places the cursor at the start of the DEFPACKAGE form. (fn PACKAGE) (defalias 'sly-goto-package-source-definition #[257 "\300\211\301!!\206/\211\302!!\206/\211\303\304 !\211\205%r\305\306\"q\210\302!)\262!\206/\307\310\"\207" [#[257 "\300!\205 \301!\210\302\207" [sly-location-p sly-move-to-source-location t] 3 "\n\n(fn LOCATION)"] sly-find-package-definition-rpc sly-find-package-definition-regexp sly-find-possible-package-file buffer-file-name find-file-noselect t sly-error "Couldn't find source definition of package: %s"] 7 (#$ . 4982)]) #@16 (fn PATTERN) (defalias 'sly-at-expression-p #[257 "\3001`\301\302!\210\303\302!\210`U0\202\210\304\207\205\"\212\301\302!\210\305!)\207" [(error) down-list 1 backward-up-list nil sly-in-expression-p] 4 (#$ . 5605)]) (defalias 'sly-goto-next-export-clause #[0 "\300\212\30120\3021\303 \210\3040\202\210\300\202/\205/\305\300w\210\306\307!\203`\262\310\301\300\"\210\2020\210)\211\2039\211b\207\311\312!\207" [nil --cl-block-nil-- (error) sly-forward-sexp t " \n " sly-at-expression-p (:export *) throw error "No next (:export ...) clause found"] 4]) #@85 Look if `symbol-name' is mentioned in one of the :EXPORT clauses. (fn SYMBOL-NAME) (defalias 'sly-search-exports-in-defpackage #[257 "\300\212\3012I\3021\303 \210\3040\202\210\305\202H\205H\212\306 \210`)\212\307\304#\203C\310 \"\203!\311\301\312 \203=`T\202>`\"\210\202!)\210\2020)\207" [#[514 "\301\302\303!\"\304\305\306#)\207" [inhibit-changing-match-data format "^\\(\\(#:\\)\\|:\\)?%s$" regexp-quote nil t string-match] 9 "\n\n(fn SYMBOL-NAME SYMBOL)"] --cl-block-nil-- (error) sly-goto-next-export-clause t nil forward-sexp search-forward sly-symbol-at-point throw sly-inside-string-p] 7 (#$ . 6181)]) #@175 Reads sexps as strings from the point to end of sexp. For example, in this situation. (for bar minor (again 123)) this will return ("bar" "minor" "(again 123)") (defalias 'sly-package-fu--read-symbols #[0 "\300\212\301\211\211 \262\203B\262\301\262\202\237\266\203)\207" [#[0 "\3001\301d!\210\302`\303 \210`\"0\207\210\304\207" [(error) forward-comment buffer-substring-no-properties forward-sexp nil] 3] nil] 6 (#$ . 6822)]) #@13 (fn NAME) (defalias 'sly-package-fu--normalize-name #[257 "\300\301\"\203 \302!\207\303\304\305#\207" [string-prefix-p "\"" read replace-regexp-in-string "^\\(\\(#:\\)\\|:\\)" ""] 5 (#$ . 7281)]) #@65 Return a list of symbols inside :export clause of a defpackage. (defalias 'sly-defpackage-exports #[0 "\212\300\301\302\3031\304 \210\3050\202\210\202.\203.\306 \210\307 \210\310\311 !\244\262\312 \210\313 \210\202\211\237\262\")\207" [mapcar sly-package-fu--normalize-name nil (error) sly-goto-next-export-clause t down-list forward-sexp reverse sly-package-fu--read-symbols up-list backward-sexp] 5 (#$ . 7489)]) #@21 (fn NAME SYMBOLS) (defalias 'sly-symbol-exported-p #[514 "\300\301\302$\207" [cl-member :test cl-equalp] 7 (#$ . 7921)]) #@285 Adds/removes `symbol' from the DEFPACKAGE form of `current-package' depending on the value of `do-what' which can either be `:export', or `:unexport'. Returns t if the symbol was added/removed. Nil if the symbol was already exported/unexported. (fn CURRENT-PACKAGE DO-WHAT SYMBOLS) (defalias 'sly-frob-defpackage-form #[771 "\212\301!\210\302\303!\210\304 \210\305 :\203\202C\306\307\267\202o\310 \210\211\203E\211@\311!\312\"\204=T\262\313!\210\210A\266\202\202$\210\202v\211\203k\211@\311!\312\"\203c\314!\210T\262\210A\266\202\202J\210\202v\315\316\317#\210\203}\320 \210\211pB\266\203)\207" [sly-package-fu-save-file sly-goto-package-source-definition down-list 1 forward-sexp sly-defpackage-exports 0 #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (:export 32 :unexport 73)) sly-add-export sly-cl-symbol-name sly-symbol-exported-p sly-package-fu--insert-symbol sly-remove-export error "cl-ecase failed: %s, %s" (:export :unexport) save-buffer] 12 (#$ . 8053)]) (defalias 'sly-add-export #[0 "\300\212\3011\302 \210\3030\202\210\202\203`\262\202)\211\203)\211b\210\304 \210\305 \207\305 \210\306\307\310 \300#\2048\311 \210\312c\210\212\313c)\207" [nil (error) sly-goto-next-export-clause t down-list sly-end-of-list looking-back "^\\s-*" line-beginning-position newline-and-indent "(:export " ")"] 5]) (defalias 'sly-determine-symbol-style #[0 "\212\301 \210\302 \210\303 \211\204\2023\304\305\"\203\306\2023\304\307\"\203'\310\2023\304\311\"\2032\312\2023\262)\207" [sly-export-symbol-representation-function sly-beginning-of-list sly-forward-sexp sly-package-fu--read-symbols cl-every #[257 "\300\301\"\207" [string-match "^:"] 4 "\n\n(fn X)"] #[257 "\300\301\"\207" [format ":%s"] 4 "\n\n(fn N)"] #[257 "\300\301\"\207" [string-match "^#:"] 4 "\n\n(fn X)"] #[257 "\300\301\"\207" [format "#:%s"] 4 "\n\n(fn N)"] #[257 "\300\301\"\207" [string-prefix-p "\""] 4 "\n\n(fn X)"] #[257 "\300\301!\226!\207" [prin1-to-string substring-no-properties] 4 "\n\n(fn N)"]] 4]) #@20 (fn SYMBOL-NAME) (defalias 'sly-format-symbol-for-defpackage #[257 "\203 \302 \202\n !\207" [sly-export-symbol-representation-auto sly-export-symbol-representation-function sly-determine-symbol-style] 3 (#$ . 10146)]) #@20 (fn SYMBOL-NAME) (defalias 'sly-package-fu--insert-symbol #[257 "\300!\301\302\303 \304#\204\305 \210\211c\207" [sly-format-symbol-for-defpackage looking-back "^\\s-*" line-beginning-position nil newline-and-indent] 6 (#$ . 10376)]) #@20 (fn SYMBOL-NAME) (defalias 'sly-remove-export #[257 "\300\301!\211\262\205+\212\211b\210\302 \210`|\210\303 \210\304\305!\203'\306 \210\307`\310 \"\210)\202\207" [nil sly-search-exports-in-defpackage backward-sexp beginning-of-line looking-at "^\\s-*$" join-line delete-trailing-whitespace line-end-position] 5 (#$ . 10620)]) #@230 Add the symbol at point to the defpackage source definition belonging to the current buffer-package. With prefix-arg, remove the symbol again. Additionally performs an EXPORT/UNEXPORT of the symbol in the Lisp image if possible. (defalias 'sly-export-symbol-at-point #[0 "\301 \302\303\"\203\304\305\"\206\306 \204\307\310!\210\203N\311\312#\211@\313A!\211\314V\262\203?\315\316$\266\202I\315\317$\266\320\"\207\311\321#\211@\313A!\211\314V\262\203o\315\322$\266\202y\315\323$\266\324\"\207" [current-prefix-arg sly-symbol-at-point string-match "^\\([^:]+\\):.*" match-string 1 sly-current-package error "No symbol at point." sly-frob-defpackage-form :unexport buffer-file-name 0 sly-message "Symbol `%s' no longer exported from `%s' in %s" "Symbol `%s' is not exported from `%s' in %s" sly-unexport-symbol :export "Symbol `%s' now exported from `%s' in %s" "Symbol `%s' already exported from `%s' in %s" sly-export-symbol] 10 (#$ . 10962) nil]) #@87 Export acessors, constructors, etc. associated with a structure or a class (fn NAME) (defalias 'sly-export-class #[257 "\300 \301\302E!\303\304\305\306#@#\207" [sly-current-package sly-eval slynk:export-structure sly-message "%s symbols exported from `%s'" sly-frob-defpackage-form :export] 9 (#$ . 11967) (byte-code "\300\301\302 \"C\207" [sly-read-from-minibuffer "Export structure named: " sly-symbol-at-point] 3)]) (defalias 'sly-export-structure 'sly-export-class) #@16 (fn PACKAGE) (defalias 'sly-package-fu--search-import-from #[257 "\300!\301\302\303\211!!\"\304\305\306#\307\310#\210\211\205\306\207" [sly-package-fu--normalize-name format "(:import-from[ ']*\\(:\\|#:\\)?%s" regexp-quote re-search-forward nil t message "Normalized: %s, regex: %s"] 8 (#$ . 12449)]) #@23 (fn PACKAGE SYMBOL) (defalias 'sly-package-fu--create-new-import-from #[514 "\300\301 !\210\302 \210\303\304\305\306#\203+\302 \210\307 \210\310!\310!\311c\210\312u\210\211c\210\307 \210c\207\313\314!\207" [sly-goto-package-source-definition sly-current-package forward-sexp re-search-backward "(:\\(use\\|import-from\\)" nil t newline-and-indent sly-format-symbol-for-defpackage "(:import-from )" -1 error "Unable to find :use form in the defpackage form."] 6 (#$ . 12766)]) #@309 Do the heavy-lifting for `sly-import-symbol-at-point'. Accept a string or a symbol like "alexandria:with-gensyms", and add it to existing (import-from #:alexandria ...) form, or create a new one. Return name of the given symbol inside of its package. For example above, return "with-gensyms". (fn SYMBOL) (defalias 'sly-package-fu--add-or-update-import-from-form #[257 "\212\302\303 !\210\304!!\305!\205\306!\204\307\310!\210\311\312\303 F!\210\211\203H\313\314\315 \"\316\317\320$\204D\321!\210 \203D\322 \210\210\202T\323\"\210 \203T\322 \210\266\203)\207" [sly-import-symbol-package-transform-function sly-package-fu-save-file sly-goto-package-source-definition sly-current-package sly-cl-symbol-package sly-cl-symbol-name sly-package-fu--search-import-from user-error "This only works on symbols with package designator." sly-eval slynk:import-symbol-for-emacs mapcar sly-package-fu--normalize-name sly-package-fu--read-symbols cl-member :test cl-equalp sly-package-fu--insert-symbol save-buffer sly-package-fu--create-new-import-from] 10 (#$ . 13255)]) #@253 Add a qualified symbol to package's :import-from subclause. Takes a package-qualified symbol at point, adds it to the current package's defpackage form (under its :import-form subclause) and replaces with a symbol name without the package designator. (defalias 'sly-import-symbol-at-point #[0 "\300 \301 @\302\223\301 A\302\223\205$\303\304\"!\211\205\"|\210\211c\262\207" [sly-bounds-of-symbol-at-point make-marker nil sly-package-fu--add-or-update-import-from-form buffer-substring-no-properties] 7 (#$ . 14347) nil]) (provide 'sly-package-fu)