Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Document functions in other.lisp #671

Merged
merged 1 commit into from
Jun 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/commands/other.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,35 @@
(define-key *global-keymap* "M-x" 'execute-command)
(define-key *global-keymap* "Shift-F10" 'show-context-menu)

(define-command nop-command () ())
(define-command nop-command () ()
"No operation; it does nothing and return nil.")

(define-command undefined-key () ()
"Signal undefined key error."
(error 'undefined-key-error))

(define-command keyboard-quit () ()
"Signal a `quit` condition."
(error 'editor-abort))

(define-command escape () ()
"Signal a `quit` condition silently."
(error 'editor-abort :message nil))

(define-command exit-lem (&optional (ask t)) ()
"Ask for modified buffers before exiting lem."
(when (or (null ask)
(not (any-modified-buffer-p))
(prompt-for-y-or-n-p "Modified buffers exist. Leave anyway"))
(exit-editor)))

(define-command quick-exit () ()
"Exit the lem job and kill it."
(lem-core/commands/file:save-some-buffers t)
(exit-editor))

(define-command execute-command (arg) ("P")
"Read a command name, then read the ARG and call the command."
(let* ((name (prompt-for-string
(if arg
(format nil "~D M-x " arg)
Expand All @@ -64,6 +71,7 @@

(define-command load-library (name)
((prompt-for-library "load library: " :history-symbol 'load-library))
"Load the Lisp library named NAME."
(message "Loading ~A." name)
(cond ((ignore-errors (maybe-quickload (format nil "lem-~A" name) :silent t))
(message "Loaded ~A." name))
Expand Down