Skip to content

Commit

Permalink
Merge pull request #3311 from atlas-engineer/delete-modes-and-commands
Browse files Browse the repository at this point in the history
Delete modes and commands
  • Loading branch information
aadcg authored Jan 15, 2024
2 parents bf3431c + 81a9ac9 commit 3d94f46
Show file tree
Hide file tree
Showing 27 changed files with 64 additions and 1,093 deletions.
8 changes: 0 additions & 8 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@
path = _build/cl-custom-hash-table
url = https://github.com/metawilm/cl-custom-hash-table
shallow = true
[submodule "_build/cl-html-diff"]
path = _build/cl-html-diff
url = https://github.com/wiseman/cl-html-diff
shallow = true
[submodule "_build/cl-difflib"]
path = _build/cl-difflib
url = https://github.com/wiseman/cl-difflib
Expand Down Expand Up @@ -558,10 +554,6 @@
path = _build/lisp-unit2
url = https://github.com/AccelerationNet/lisp-unit2
shallow = true
[submodule "_build/montezuma"]
path = _build/montezuma
url = https://github.com/sharplispers/montezuma
shallow = true
[submodule "_build/nsymbols"]
path = _build/nsymbols
url = https://github.com/atlas-engineer/nsymbols
Expand Down
1 change: 0 additions & 1 deletion _build/cl-html-diff
Submodule cl-html-diff deleted from 5a0b39
1 change: 0 additions & 1 deletion _build/montezuma
Submodule montezuma deleted from ee2129
2 changes: 0 additions & 2 deletions build-scripts/nyxt.scm
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,13 @@
cl-fset
cl-gopher
cl-history-tree
cl-html-diff
cl-iolib
cl-json
cl-lass
cl-local-time
cl-lparallel
cl-log4cl
cl-mk-string-metrics
cl-montezuma
cl-moptilities
cl-named-readtables
cl-nclasses
Expand Down
1 change: 0 additions & 1 deletion documents/SOURCES.org
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Experimental support.
- bordeaux-threads
- calispel
- cl-custom-hash-table
- cl-html-diff
- cl-json
- cl-ppcre
- cl-ppcre-unicode
Expand Down
11 changes: 0 additions & 11 deletions nyxt.asd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
cl-base64
cl-colors2
cl-gopher
cl-html-diff
cl-json
cl-ppcre
cl-ppcre-unicode
Expand All @@ -48,7 +47,6 @@
local-time
lparallel
log4cl
montezuma
ndebug
nclasses
nfiles
Expand Down Expand Up @@ -214,17 +212,13 @@
(:file "no-sound")
(:file "no-webgl")
(:file "password")
(:file "preview")
(:file "reading-line")
(:file "record-input-field")
(:file "reduce-bandwidth")
(:file "reduce-tracking")
(:file "repeat")
(:file "repl")
(:file "remembrance" :depends-on ("bookmark"))
(:file "small-web")
(:file "style" :depends-on ("bookmarklets"))
(:file "tts")
(:file "visual")
(:file "vi")
(:file "watch"))))
Expand Down Expand Up @@ -298,15 +292,12 @@
(:file "no-webgl")
(:file "passthrough")
(:file "password")
(:file "preview")
(:file "process")
(:file "prompt-buffer")
(:file "proxy")
(:file "reading-line")
(:file "record-input-field")
(:file "reduce-bandwidth")
(:file "reduce-tracking")
(:file "remembrance")
;; TODO Fix repeat-mode architecture. Visit the file below for
;; more information.
;; (:file "repeat")
Expand All @@ -315,7 +306,6 @@
(:file "small-web")
(:file "spell-check")
(:file "style")
(:file "tts")
(:file "vi")
;; TODO Fix visual-mode architecture. Visit the file below for
;; more information.
Expand Down Expand Up @@ -394,7 +384,6 @@
:components ((:file "tests/renderer-package")
(:file "tests/renderer-offline/set-url")
(:file "tests/renderer-offline/execute-command-eval")
(:file "tests/renderer-offline/remembrance")
(:file "tests/renderer-offline/nyxt-url-security")
(:file "tests/renderer-offline/search-buffer")
;; See https://github.com/atlas-engineer/nyxt/issues/3172
Expand Down
5 changes: 0 additions & 5 deletions source/browser.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ This history is used if no history is specified for a given prompt buffer.")
(set-url-history
(make-ring)
:documentation "The history of all URLs set via set-url")
(old-prompt-buffers
'()
:export nil
:documentation "The list of old prompt buffers.
This can be used to resume former buffers.")
(recent-buffers
(make-ring :size 50)
:export nil
Expand Down
30 changes: 4 additions & 26 deletions source/buffer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1319,23 +1319,6 @@ See `make-buffer' for a description of the arguments."
(declare (ignorable title modes url))
(apply #'make-buffer (append (list :buffer-class 'background-buffer :no-history-p t) args)))

(define-command duplicate-buffer-with-current-modes (&key (modes nil) parent-buffer)
"Duplicate current buffer in a new buffer with current modes as well."
(let* ((curr-buffer (current-buffer))
(buffer (make-buffer :title (title curr-buffer)
:url (url curr-buffer)
:modes (or modes
(mapcar #'sera:class-name-of
(modes curr-buffer)))
:parent-buffer parent-buffer)))
(set-current-buffer buffer)
buffer))

(define-command duplicate-buffer (&key parent-buffer)
"Duplicate current buffer in a new buffer."
(duplicate-buffer-with-current-modes :modes (list (sym:resolve-symbol :document-mode :mode) 'base-mode)
:parent-buffer parent-buffer))

(-> add-to-recent-buffers (buffer) *)
(defun add-to-recent-buffers (buffer)
"Create a recent-buffer from given buffer and add it to `recent-buffers'."
Expand Down Expand Up @@ -1962,15 +1945,10 @@ specified for their contents."
:sources (url-sources (current-buffer) actions-on-return))
(current-buffer)))

(define-command reload-buffer
(&optional (buffer
(prompt
:prompt "Reload buffer(s)"
:sources (make-instance 'buffer-source))))
"Reload BUFFER.
Return it."
(when buffer
(buffer-load (url buffer) :buffer buffer)))
(export-always 'reload-buffer)
(defun reload-buffer (buffer)
"Reload BUFFER and return it."
(buffer-load (url buffer) :buffer buffer))

(define-command reload-current-buffer ()
"Reload current buffer.
Expand Down
30 changes: 26 additions & 4 deletions source/changelog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -427,16 +427,16 @@ for a better overview of lengthy attributes.")
(:nsection
:title "New modes"
(:ul
(:li "New " (:nxref :mode 'nyxt/mode/record-input-field:record-input-field-mode)
(:li "New " (:code "nyxt/mode/record-input-field:record-input-field-mode")
" to record and restore input fields.")
(:li (:nxref :command 'nyxt/mode/repl:repl "Lisp REPL")
" is fully redesigned into a multiple-pane environment with debugging, value
inspection, convenient editing bindings, and full extensibility via "
(:nxref :class-name 'nyxt/mode/repl:cell) " and " (:nxref :function 'value->html) ".")
(:li "New " (:nxref :class-name 'nyxt/mode/remembrance:remembrance-mode)
(:li "New " (:code "nyxt/mode/remembrance:remembrance-mode")
" to automatically cache the visited page content. The cache can be looked up
and the page textual content can be displayed even offline. See "
(:nxref :function 'nyxt/mode/remembrance:recollect-visited-page) ".")))
(:code "nyxt/mode/remembrance:recollect-visited-page") ".")))

(:nsection
:title "New commands"
Expand Down Expand Up @@ -997,4 +997,26 @@ enabling its customization.")
(:li "The height of the " (:nxref :class-name 'message-buffer) " and "
(:nxref :class-name 'status-buffer) " can be dynamically set and its UI
elements are scaled accordingly.")
(:li "Remove experimental support for WebExtensions via " (:code "libnyxt") ".")))
(:li "Remove experimental support for WebExtensions via " (:code "libnyxt") ".")
(:li "Delete commands:"
(:ul
(:li (:code "clean-configuration"))
(:li (:code "copy-placeholder"))
(:li (:code "dashboard"))
(:li (:code "duplicate-buffer"))
(:li (:code "duplicate-buffer-with-current-modes"))
(:li (:code "follow-hint-with-current-modes-new-buffer"))
(:li (:code "go-next"))
(:li (:code "go-previous"))
(:li (:code "go-to-homepage"))
(:li (:code "go-up"))
(:li (:code "print-bindings"))
(:li (:code "reload-buffer"))
(:li (:code "reload-with-modes"))
(:li (:code "resume-prompt"))))
(:li "Delete modes:"
(:ul
(:li (:code "nyxt/mode/no-procrastinate"))
(:li (:code "nyxt/mode/preview"))
(:li (:code "nyxt/mode/record-input-field"))
(:li (:code "nyxt/mode/tts"))))))
5 changes: 3 additions & 2 deletions source/configuration-commands.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ On error, return the condition as a first value and the backtrace as second valu
(dolist (file files)
(load-lisp file))))))

(define-command clean-configuration ()
"Clean all the user configuration created with `define-configuration' or `customize-instance'."
(export-always 'clean-configuration)
(defun clean-configuration ()
"Undo user configuration set by `define-configuration' or `customize-instance'."
(dolist (class (sera:filter #'user-class-p (sym:package-classes* (nyxt-packages))))
(setf (hooks:handlers-alist (slot-value class 'customize-hook)) nil))
(dolist (method (mopu:generic-function-methods #'customize-instance))
Expand Down
63 changes: 0 additions & 63 deletions source/help.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -376,20 +376,6 @@ to the next."
(:p "To use the external editor, you need to set the VISUAL or EDITOR environment variables on your system.")
(:p "Otherwise, you can use the basic internal text editor."))))))))))

(define-command print-bindings ()
"Display all known bindings for the current buffer."
(nyxt::html-set-style (theme:themed-css (theme *browser*)
`(h3
:font-size "10px"
:font-family ,theme:font-family
:font-weight 500)
`(tr
:font-size "7px")
`(div
:display inline-block))
(describe-bindings))
(nyxt/mode/document:print-buffer))

(defun tls-help (buffer url)
"Helper function invoked upon TLS certificate errors."
(setf (status buffer) :failed)
Expand Down Expand Up @@ -547,52 +533,3 @@ clipboard."
(copy-to-clipboard nyxt-information)
(log:info nyxt-information)
(echo "System information saved to clipboard."))))

(define-internal-page-command-global dashboard ()
(buffer "*Dashboard*")
"Display a dashboard featuring bookmarks, recent URLs and other useful actions."
(flet ((list-bookmarks (&key (limit 50) (separator ""))
(spinneret:with-html-string
(let ((mode (make-instance 'nyxt/mode/bookmark:bookmark-mode)))
(alex:if-let ((bookmarks (files:content (nyxt/mode/bookmark:bookmarks-file mode))))
(dolist (bookmark (sera:take limit (the list (sort-by-time bookmarks :key #'nyxt/mode/bookmark:date))))
(:li (title bookmark) separator
(:a :href (render-url (url bookmark))
(render-url (url bookmark)))))
(:p (format nil "No bookmarks in ~s." (files:expand (nyxt/mode/bookmark:bookmarks-file mode)))))))))
(let ((dashboard-style (theme:themed-css (theme *browser*)
`(body
:background-color ,theme:background
:color ,theme:on-background
:margin-top 0
:margin-bottom 0)
`("#title"
:font-size "400%")
`("#subtitle"
:color ,theme:secondary)
`(.section
:border-style "solid none none none"
:border-color ,theme:secondary
:margin-top "10px"
:overflow "scroll"
:min-height "150px")
`("h3"
:color ,theme:secondary)
`("ul"
:list-style-type "circle"))))
(spinneret:with-html-string
(:nstyle dashboard-style)
(:div
(:h1 :id "title" "Nyxt " (:span :id "subtitle" "browser ☺"))
(:h3 (time:format-timestring nil (time:now) :format time:+rfc-1123-format+))
(:nbutton :text "🗁 Restore Session"
'(nyxt::restore-history-by-name))
(:a :class "button" :href (nyxt-url 'manual) "🕮 Manual")
(:nbutton
:text "≡ Execute Command"
'(nyxt::execute-command))
(:a :class "button" :href "https://nyxt-browser.com/download" "⇡ Update"))
(:h3 (:b "Recent URLs"))
(:ul (:raw (history-html-list :limit 50)))
(:h3 (:b "Recent bookmarks"))
(:ul (:raw (list-bookmarks :limit 50)))))))
31 changes: 25 additions & 6 deletions source/migration.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,27 @@ major versions."
(conservative-history-movement-p)
(:p "Deprecated in favor of " (:nxref :slot 'global-history-p :class-name 'buffer) ".")

nyxt/mode/no-procrastinate
(:p "Deprecated mode."))
(nyxt/mode/no-procrastinate
nyxt/mode/preview
nyxt/mode/record-input-field
nyxt/mode/tts)
(:p "Deprecated modes.")

(copy-placeholder
#:clean-configuration
dashboard
duplicate-buffer
duplicate-buffer-with-current-modes
follow-hint-with-current-modes-new-buffer
go-next
go-previous
go-to-homepage
go-up
print-bindings
reload-buffer
reload-with-modes
resume-prompt)
(:p "Deprecated commands."))

(define-migration "3"
(%slot-default)
Expand Down Expand Up @@ -368,7 +387,7 @@ major versions."
(:code "nyxt/\([a-z-]*\)-mode") " with " (:code "nyxt/mode/\\1") ".")

nyxt/preview-mode
(:p "Renamed to " (:nxref :class-name 'nyxt/mode/preview) "."
(:p "Renamed to " (:code "nyxt/mode/preview") "."
" Query replace the regexp "
(:code "nyxt/\([a-z-]*\)-mode") " with " (:code "nyxt/mode/\\1") ".")

Expand All @@ -393,7 +412,7 @@ major versions."
(:code "nyxt/\([a-z-]*\)-mode") " with " (:code "nyxt/mode/\\1") ".")

nyxt/record-input-field-mode
(:p "Renamed to " (:nxref :class-name 'nyxt/mode/record-input-field) "."
(:p "Renamed to " (:code 'nyxt/mode/record-input-field) "."
" Query replace the regexp "
(:code "nyxt/\([a-z-]*\)-mode") " with " (:code "nyxt/mode/\\1") ".")

Expand All @@ -408,7 +427,7 @@ major versions."
(:code "nyxt/\([a-z-]*\)-mode") " with " (:code "nyxt/mode/\\1") ".")

nyxt/remembrance-mode
(:p "Renamed to " (:nxref :class-name 'nyxt/mode/remembrance) "."
(:p "Renamed to " (:code "nyxt/mode/remembrance") "."
" Query replace the regexp "
(:code "nyxt/\([a-z-]*\)-mode") " with " (:code "nyxt/mode/\\1") ".")

Expand Down Expand Up @@ -443,7 +462,7 @@ major versions."
(:code "nyxt/\([a-z-]*\)-mode") " with " (:code "nyxt/mode/\\1") ".")

nyxt/tts-mode
(:p "Renamed to " (:nxref :class-name 'nyxt/mode/tts) "."
(:p "Renamed to " (:code 'nyxt/mode/tts) "."
" Query replace the regexp "
(:code "nyxt/\([a-z-]*\)-mode") " with " (:code "nyxt/mode/\\1") ".")

Expand Down
19 changes: 0 additions & 19 deletions source/mode.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -531,25 +531,6 @@ If it's a single buffer, return it directly (not as a list)."
(disable existing-instance)
(echo "~@(~a~) mode disabled." existing-instance))))))

(define-command-global reload-with-modes (&optional (buffer (current-buffer)))
"Reload the BUFFER with the queried modes.
This bypasses auto-rules.
Auto-rules are re-applied once the page is reloaded once again."
(let* ((modes-to-enable (prompt
:prompt "Mark modes to enable, unmark to disable"
:sources (make-instance 'mode-source
:marks (mapcar #'sera:class-name-of (modes (current-buffer))))))
(modes-to-disable (set-difference (all-mode-symbols) modes-to-enable
:test #'string=)))
(hooks:once-on (request-resource-hook buffer)
(request-data)
(when modes-to-enable
(disable-modes* modes-to-disable buffer))
(when modes-to-disable
(enable-modes* modes-to-enable buffer))
request-data)
(reload-buffer buffer)))

(export-always 'find-buffer)
(defun find-buffer (mode-symbol)
"Return first buffer matching MODE-SYMBOL."
Expand Down
Loading

0 comments on commit 3d94f46

Please sign in to comment.