Skip to content

Commit 467fdc4

Browse files
committed
Propagate prompter library renaming changes.
The key observation motivating the renaming is (in the old parlance): marks are valid when multi-selection-p is non-nil, which makes us think of a selection (a set of items). But that collides with the concept of "the current suggestion", which we call selection. Concepts renamed according to table: | selection | current-suggestion | | return-action | actions-on-return | | marks-actions | actions-on-marks | | selection-actions | actions-on-current-suggestion | Slot multi-selection-p renamed to enable-marks-p. Functions renamed according to table: | select-previous | previous-suggestion | | select-next | next-suggestion | | select-first | first-suggestion | | select-last | last-suggestion | | select-previous-page | previous-page | | select-next-page | next-page | | select-previous-source | previous-source | | select-next-source | next-source | | toggle-mark | toggle-mark-forwards | | cancel-input | quit-prompt-buffer | | return-selection | run-action-on-return | | set-selection-action | set-action-on-return | | selected-suggestion | %current-suggestion | | selected-source | current-source | | selected-suggestion-position | current-suggestion-position | | select | set-current-suggestion | | insert-selection | insert-current-suggestion | Uniformize references to prompt buffer in docstrings. For the purpose of documentation, the hyphen should not be used.
1 parent 325a8c1 commit 467fdc4

40 files changed

+532
-461
lines changed

README.org

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ matching series of letters.
3030

3131
#+html: <img src="https://nyxt.atlas.engineer/static/image/switch-buffer.png?" align="center"/>
3232

33-
** Multiple selection
33+
** Multiple marking
3434

3535
Commands can accept multiple inputs, allowing you to quickly perform an
3636
operation against multiple objects. In the example below we search for

source/auto-rules.lisp

+2-2
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ For the storage format see the comment in the header of your `auto-rules-file'."
312312
(make-instance 'prompter:raw-source
313313
:name "New URL")
314314
(make-instance 'global-history-source
315-
:return-actions #'identity)))))
315+
:actions-on-return #'identity)))))
316316
(when (typep url 'nyxt::history-entry)
317317
(setf url (url url)))
318318
(add-modes-to-auto-rules
@@ -344,7 +344,7 @@ For the storage format see the comment in the header of your `auto-rules-file'."
344344
(make-instance 'prompter:raw-source
345345
:name "New URL")
346346
(make-instance 'global-history-source
347-
:return-actions #'identity)))))
347+
:actions-on-return #'identity)))))
348348
(setf url (url url))
349349
(add-modes-to-auto-rules (url-infer-match url)
350350
:include (rememberable-of (modes (current-buffer)))

source/browser.lisp

+4-4
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ buffers, load data files, open prompt buffer, etc).")
163163
(native-dialogs
164164
t
165165
:type boolean
166-
:documentation "Whether to use prompt-buffer-reliant script dialogs and file-chooser.
167-
If nil, renderer-provided dialogs are used.")
166+
:documentation "Whether to replace renderer specific dialog boxes with the
167+
prompt buffer.")
168168
(theme
169169
(make-instance 'theme:theme)
170170
:type theme:theme
@@ -645,8 +645,8 @@ set of useful URLs or preparing a list to send to a someone else."
645645
:sources (make-instance 'buffer-source
646646
:constructor (remove-if #'internal-url-p (buffer-list)
647647
:key #'url)
648-
:return-actions #'identity
649-
:multi-selection-p t))))
648+
:actions-on-return #'identity
649+
:enable-marks-p t))))
650650
(unwind-protect
651651
(spinneret:with-html-string
652652
(:h1 "Reduced Buffers:")

source/buffer.lisp

+38-37
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,8 @@ down."))
436436
(j:decode results)))))))
437437
:type (cons search-engine *)
438438
:documentation "A list of the `search-engine' objects.
439-
You can invoke them from the prompt-buffer by prefixing your query with SHORTCUT.
439+
You can invoke them from the prompt buffer by prefixing your query with
440+
SHORTCUT.
440441
If the query is empty, FALLBACK-URL is loaded instead. If
441442
FALLBACK-URL is empty, SEARCH-URL is used on an empty search.
442443
@@ -945,7 +946,7 @@ identifiers."
945946
(buffer
946947
(current-buffer)
947948
:type buffer)
948-
(prompter:multi-selection-p t)
949+
(prompter:enable-marks-p t)
949950
(prompter:constructor (lambda (source)
950951
(mapcar #'first (nyxt::keywords (buffer source))))))
951952
(:accessor-name-transformer (class*:make-name-transformer name))
@@ -1261,15 +1262,15 @@ proceeding."
12611262
(define-class buffer-source (prompter:source)
12621263
((prompter:name "Buffer list")
12631264
(prompter:constructor (buffer-initial-suggestions :current-is-last-p nil))
1264-
(prompter:multi-selection-p t)
1265-
(prompter:return-actions (list (lambda-unmapped-command set-current-buffer)
1266-
(lambda-mapped-command buffer-delete)
1267-
'reload-buffers))
1268-
(prompter:selection-actions-enabled-p t)
1269-
(prompter:selection-actions-delay 0.1)
1270-
(prompter:selection-actions (lambda-command set-current-buffer* (buffer)
1271-
"Set current BUFFER for the active window."
1272-
(set-current-buffer buffer :focus nil)))
1265+
(prompter:enable-marks-p t)
1266+
(prompter:actions-on-return (list (lambda-unmapped-command set-current-buffer)
1267+
(lambda-mapped-command buffer-delete)
1268+
'reload-buffers))
1269+
(prompter:actions-on-current-suggestion-enabled-p t)
1270+
(prompter:actions-on-current-suggestion-delay 0.1)
1271+
(prompter:actions-on-current-suggestion (lambda-command set-current-buffer* (buffer)
1272+
"Set current BUFFER for the active window."
1273+
(set-current-buffer buffer :focus nil)))
12731274
(prompter:destructor (let ((buffer (current-buffer)))
12741275
(lambda (prompter source)
12751276
(declare (ignore source))
@@ -1330,8 +1331,8 @@ second latest buffer first."
13301331
:prompt "Delete buffer(s)"
13311332
:sources (make-instance
13321333
'buffer-source
1333-
:multi-selection-p t
1334-
:return-actions
1334+
:enable-marks-p t
1335+
:actions-on-return
13351336
(list (lambda-mapped-command buffer-delete)
13361337
(lambda-command buffer-delete-duplicates* (buffers)
13371338
"Delete all buffers with same URLs, except the chosen ones."
@@ -1425,9 +1426,9 @@ URL-DESIGNATOR is then transformed by BUFFER's `buffer-load-hook'."
14251426
(prompter:constructor (lambda (source)
14261427
(declare (ignorable source))
14271428
(history-initial-suggestions)))
1428-
(prompter:multi-selection-p t)
1429+
(prompter:enable-marks-p t)
14291430
(prompter:filter-preprocessor nil) ; Don't remove non-exact results.
1430-
(prompter:return-actions #'buffer-load))
1431+
(prompter:actions-on-return #'buffer-load))
14311432
(:export-class-name-p t)
14321433
(:metaclass user-class))
14331434

@@ -1583,7 +1584,7 @@ Finally, if nothing else, set the `engine' to the `default-search-engine'."))
15831584
(input->queries input
15841585
:check-dns-p t
15851586
:engine-completion-p t)))
1586-
(prompter:return-actions #'buffer-load))
1587+
(prompter:actions-on-return #'buffer-load))
15871588
(:export-class-name-p t)
15881589
(:documentation "This prompter source tries to \"do the right thing\" to
15891590
generate a new URL query from user input.
@@ -1611,26 +1612,26 @@ any.")
16111612
(prompter::history-pushnew history (render-url url))))
16121613

16131614
(export-always 'url-sources)
1614-
(defmethod url-sources ((buffer buffer) return-actions)
1615+
(defmethod url-sources ((buffer buffer) actions-on-return)
16151616
(append
1616-
(list (make-instance 'new-url-or-search-source :return-actions return-actions)
1617+
(list (make-instance 'new-url-or-search-source :actions-on-return actions-on-return)
16171618
(make-instance
16181619
'global-history-source
1619-
:return-actions (append (uiop:ensure-list return-actions)
1620-
(list (lambda-command delete-history-entry* (suggestion-values)
1621-
"Delete chosen history entries (not belonging to open buffers)."
1622-
(files:with-file-content (history (history-file buffer))
1623-
(dolist (entry suggestion-values)
1624-
(htree:delete-data history entry)))))))
1625-
(make-instance 'search-engine-url-source :return-actions return-actions))
1626-
(mappend (rcurry #'url-sources (uiop:ensure-list return-actions)) (modes buffer))))
1620+
:actions-on-return (append (uiop:ensure-list actions-on-return)
1621+
(list (lambda-command delete-history-entry* (suggestion-values)
1622+
"Delete chosen history entries (not belonging to open buffers)."
1623+
(files:with-file-content (history (history-file buffer))
1624+
(dolist (entry suggestion-values)
1625+
(htree:delete-data history entry)))))))
1626+
(make-instance 'search-engine-url-source :actions-on-return actions-on-return))
1627+
(mappend (rcurry #'url-sources (uiop:ensure-list actions-on-return)) (modes buffer))))
16271628

16281629
(define-command set-url (&key (url nil explicit-url-p) (prefill-current-url-p t))
16291630
"Set the URL for the current buffer, completing with history."
16301631
(if explicit-url-p
16311632
(buffer-load (url url))
16321633
(let ((history (set-url-history *browser*))
1633-
(return-actions
1634+
(actions-on-return
16341635
(list (lambda-command buffer-load* (suggestion-values)
16351636
"Load first selected URL in current buffer and the rest in new buffer(s)."
16361637
(mapc (lambda (suggestion) (make-buffer :url (url suggestion))) (rest suggestion-values))
@@ -1653,31 +1654,31 @@ any.")
16531654
:input (if prefill-current-url-p
16541655
(render-url (url (current-buffer))) "")
16551656
:history history
1656-
:sources (url-sources (current-buffer) return-actions))
1657+
:sources (url-sources (current-buffer) actions-on-return))
16571658
(current-buffer))))
16581659

16591660
(define-command set-url-new-buffer (&key (url nil explicit-url-p) (prefill-current-url-p t))
16601661
"Prompt for a URL and set it in a new focused buffer."
16611662
(if explicit-url-p
16621663
(make-buffer-focus :url (url url))
16631664
(let ((history (set-url-history *browser*))
1664-
(return-actions (lambda-command new-buffer-load (suggestion-values)
1665-
"Load URL(s) in new buffer(s)"
1666-
(mapc (lambda (suggestion) (make-buffer :url (url suggestion)))
1667-
(rest suggestion-values))
1668-
(make-buffer-focus :url (url (first suggestion-values))))))
1665+
(actions-on-return (lambda-command new-buffer-load (suggestion-values)
1666+
"Load URL(s) in new buffer(s)"
1667+
(mapc (lambda (suggestion) (make-buffer :url (url suggestion)))
1668+
(rest suggestion-values))
1669+
(make-buffer-focus :url (url (first suggestion-values))))))
16691670
(pushnew-url-history history (url (current-buffer)))
16701671
(prompt
16711672
:prompt "Open URL in new buffer"
16721673
:input (if prefill-current-url-p
16731674
(render-url (url (current-buffer))) "")
16741675
:history history
1675-
:sources (url-sources (current-buffer) return-actions))
1676+
:sources (url-sources (current-buffer) actions-on-return))
16761677
(current-buffer))))
16771678

16781679
(define-command set-url-new-nosave-buffer (&key (prefill-current-url-p t))
16791680
"Prompt for a URL and set it in a new focused nosave buffer."
1680-
(let ((return-actions
1681+
(let ((actions-on-return
16811682
(lambda-command new-nosave-buffer-load (suggestion-values)
16821683
"Load URL(s) in new nosave buffer(s)"
16831684
(mapc (lambda (suggestion) (make-nosave-buffer :url (url suggestion)))
@@ -1688,7 +1689,7 @@ any.")
16881689
:prompt "Open URL in new nosave buffer"
16891690
:input (if prefill-current-url-p
16901691
(render-url (url (current-buffer))) "")
1691-
:sources (url-sources (current-buffer) return-actions))
1692+
:sources (url-sources (current-buffer) actions-on-return))
16921693
(current-buffer)))
16931694

16941695
(define-command reload-buffer
@@ -1710,7 +1711,7 @@ Return it."
17101711
(&optional (buffers
17111712
(prompt
17121713
:prompt "Reload buffer(s)"
1713-
:sources (make-instance 'buffer-source :multi-selection-p t))))
1714+
:sources (make-instance 'buffer-source :enable-marks-p t))))
17141715
"Prompt for BUFFERS to be reloaded.
17151716
Return BUFFERS."
17161717
(when buffers

0 commit comments

Comments
 (0)