mirror of https://codeberg.org/cage/tinmop/
Compare commits
2 Commits
570cad0394
...
5201953a08
Author | SHA1 | Date |
---|---|---|
cage | 5201953a08 | |
cage | 5f8c20ce7d |
|
@ -119,7 +119,7 @@ color-regexp = "➶ .+" magenta bold
|
|||
|
||||
# header level 1
|
||||
|
||||
color-regexp = "🞂 .+" white bold
|
||||
color-regexp = "^🞂.*" white bold
|
||||
|
||||
# header level 2
|
||||
|
||||
|
|
|
@ -165,10 +165,12 @@
|
|||
(list (coerce (second a) 'string))))))
|
||||
|
||||
(defrule quote-line (and quote-prefix
|
||||
text-line)
|
||||
(? text-line))
|
||||
(:function (lambda (a) (list (first a)
|
||||
nil
|
||||
(tag-value (second a))))))
|
||||
(if (second a)
|
||||
(tag-value (second a))
|
||||
"")))))
|
||||
|
||||
(defrule gemini-file (* (or h3
|
||||
h2
|
||||
|
@ -467,11 +469,15 @@
|
|||
(format nil "~a~a~%" (link-prefix-gemini theme) link-name)
|
||||
(format nil "~a~a~%" (link-prefix-other theme) link-name)))
|
||||
(fit-quote-lines (line win-width)
|
||||
(let* ((justified (flush-left-mono-text (split-words line)
|
||||
(let* ((words (split-words line))
|
||||
(quote-prefix (quote-prefix theme))
|
||||
(justified (flush-left-mono-text words
|
||||
(- win-width
|
||||
(length (quote-prefix theme)))))
|
||||
(lines (mapcar (lambda (a) (strcat (quote-prefix theme) a))
|
||||
justified)))
|
||||
(length quote-prefix))))
|
||||
(lines (if justified
|
||||
(mapcar (lambda (a) (strcat quote-prefix a))
|
||||
justified)
|
||||
quote-prefix)))
|
||||
(make-quoted-lines (join-with-strings lines (format nil "~%")))))
|
||||
(pre-alt-text (node)
|
||||
(trim (html-utils:attribute-value (html-utils:find-attribute :alt node))))
|
||||
|
|
|
@ -114,11 +114,13 @@ etc.) happened"
|
|||
(invoke-restart 'res:create-empty-in-home))))
|
||||
(swconf:load-config-file swconf:+conf-filename+)))
|
||||
|
||||
(defun shared-init ()
|
||||
(load-configuration-files)
|
||||
(init-db))
|
||||
|
||||
(defun init ()
|
||||
"Initialize the program"
|
||||
;; (res:init)
|
||||
;; (load-configuration-files)
|
||||
;; (init-db)
|
||||
(shared-init)
|
||||
(db-utils:with-ready-database (:connect nil)
|
||||
(complete:initialize-complete-username-cache)
|
||||
(handler-case
|
||||
|
@ -182,7 +184,7 @@ etc.) happened"
|
|||
(defun load-script-file ()
|
||||
"Load (execute) a lisp file used in requests of a command line switch"
|
||||
(setf program-events:*process-events-immediately* t)
|
||||
(init-db)
|
||||
(shared-init)
|
||||
(db-utils:with-ready-database (:connect nil)
|
||||
(client:init)
|
||||
(client:authorize)
|
||||
|
@ -192,8 +194,6 @@ etc.) happened"
|
|||
"The entry point function of the program"
|
||||
(init-i18n)
|
||||
(res:init)
|
||||
(load-configuration-files)
|
||||
(init-db)
|
||||
(command-line:manage-opts)
|
||||
(if command-line:*script-file*
|
||||
(load-script-file)
|
||||
|
|
|
@ -73,20 +73,37 @@
|
|||
(values exe args))
|
||||
(values editor nil))))))
|
||||
|
||||
(defun run-external-program (program args
|
||||
&key
|
||||
(wait t)
|
||||
search
|
||||
#-win32 pty
|
||||
input
|
||||
output
|
||||
(error :output))
|
||||
(sb-ext:run-program program
|
||||
args
|
||||
:wait wait
|
||||
:search search
|
||||
:pty pty
|
||||
:input input
|
||||
:output output
|
||||
:error error))
|
||||
|
||||
(defun open-with-editor (file)
|
||||
(multiple-value-bind (exe args)
|
||||
(external-editor)
|
||||
(let ((actual-args (if args
|
||||
(text-utils:split-words args)
|
||||
nil)))
|
||||
(sb-ext:run-program exe
|
||||
(append actual-args
|
||||
(list file))
|
||||
:search t
|
||||
:wait t
|
||||
:input t
|
||||
:output t
|
||||
:error t))))
|
||||
(run-external-program exe
|
||||
(append actual-args
|
||||
(list file))
|
||||
:search t
|
||||
:wait t
|
||||
:input t
|
||||
:output t
|
||||
:error t))))
|
||||
|
||||
(defun exit-program (&optional (exit-code 0))
|
||||
(uiop:quit exit-code))
|
||||
|
@ -106,35 +123,35 @@
|
|||
"-keyout ~a -outform PEM -out ~a")
|
||||
key-file
|
||||
cert-file)))
|
||||
(sb-ext:run-program +openssl-bin+
|
||||
(text-utils:split-words cmd-args)
|
||||
:output nil
|
||||
:error :output)
|
||||
(run-external-program +openssl-bin+
|
||||
(text-utils:split-words cmd-args)
|
||||
:output nil
|
||||
:error :output)
|
||||
(values cert-file key-file)))
|
||||
|
||||
(defun send-to-pipe (data program-and-args)
|
||||
(croatoan:end-screen)
|
||||
(with-input-from-string (stream data)
|
||||
(let ((command-line-splitted (text-utils:split-words program-and-args)))
|
||||
(sb-ext:run-program (first command-line-splitted)
|
||||
(rest command-line-splitted)
|
||||
:search t
|
||||
:wait t
|
||||
:input stream
|
||||
:output t
|
||||
:error t))))
|
||||
(run-external-program (first command-line-splitted)
|
||||
(rest command-line-splitted)
|
||||
:search t
|
||||
:wait t
|
||||
:input stream
|
||||
:output t
|
||||
:error t))))
|
||||
|
||||
(defun open-link-with-program (program-and-args link)
|
||||
(let* ((command-line-splitted (text-utils:split-words program-and-args))
|
||||
(program (first command-line-splitted))
|
||||
(args (append (rest command-line-splitted)
|
||||
(list link))))
|
||||
(sb-ext:run-program program
|
||||
args
|
||||
:search t
|
||||
:wait nil
|
||||
:output nil
|
||||
:error :output)))
|
||||
(run-external-program program
|
||||
args
|
||||
:search t
|
||||
:wait nil
|
||||
:output nil
|
||||
:error :output)))
|
||||
|
||||
(defun open-resource-with-external-program (resource give-focus-to-message-window)
|
||||
(let ((program (swconf:link-regex->program-to-use resource)))
|
||||
|
|
Loading…
Reference in New Issue