From e40cfc8c2d53b4deddbd54c0f89fb5d2b2bb7139 Mon Sep 17 00:00:00 2001 From: cage Date: Sat, 9 May 2020 13:53:09 +0200 Subject: [PATCH] - updated manpage; - updated italian translation; - added a couple of resources reltaed functions. --- doc/man.org | 42 ++++++++--- doc/tinmop.man | 158 +++++++++++++++++++++++---------------- po/it.po | 25 ++++--- po/tinmop.pot | 19 +++-- src/modules.lisp | 4 + src/package.lisp | 2 + src/resources-utils.lisp | 7 ++ 7 files changed, 167 insertions(+), 90 deletions(-) diff --git a/doc/man.org b/doc/man.org index 82b1bfe..88bb115 100644 --- a/doc/man.org +++ b/doc/man.org @@ -29,7 +29,7 @@ * Usage - Users of Tinmop are expected to interacts with the social network + Users of Tinmop supposed to interacts with the social network using a terminal interface (TUI), The terminal screen layout is sketched below: @@ -66,7 +66,7 @@ - command window :: the window where the user instruct the software to perform commands - The only way to interact with the program is using the keyboard. + The main way to interact with the program is using the keyboard. There is a contextual help that appears when the user input data that provide hints about commands and a quick help window that can be shown by hitting ~?~ (if this keybinding has not been @@ -75,7 +75,7 @@ ** Folders A folder is an object to groups messages for each timeline an - arbitrary number of folder can be created, when the last message of + arbitrary number of folders can be created, when the last message of a folder is deleted the folder is deleted as well. * Configuration @@ -101,7 +101,7 @@ #+BEGIN_SRC text # a file can be included in another with this directive: - use "default-theme.conf" + use "shared.conf" # a line starting with a '#' is a comment # The server instance name @@ -122,14 +122,14 @@ The file with this credential are confidential and must be put into user's home directory under the path - ~/home/username/.local/share/tinmop/~. Probably the directory + ~$HOME/.local/share/tinmop/main.conf~. Probably the directory ~tinmop~ does not exists on user system, if it does not exists must be created manually. If the program was installed correctly two other files with simple semantics are located in your system wide configuration directory (usually ~/etc/tinmop/~), please check these files for more - information, as are extensively commented. + information, as they are extensively commented. ** Lisp program @@ -149,9 +149,10 @@ Again in the configuration directory there is a (commented) file named ~init.lisp~ that user can use as their starting point to - write their files. A custom init file (or other module files must - be located into the directory ~$HOME/.local/share/tinmop/~ - to be successfully loaded. + write their files. A custom init file, or other module files, must + be located into the directory ~$HOME/.local/share/tinmop/~ or + ~$HOME/.config/tinmop/~ (because, you know, data is code and code + is data) to be successfully loaded. However there is no need to write their own init file if user is happy with the provided one by the package maintainers. @@ -190,6 +191,29 @@ See also the file CONTRIBUTE.org +** Debug mode + + If you decomment the line: + + #+BEGIN_SRC lisp + ;;(push :debug-mode *features*) + #+END_SRC + + The program will be compiled in ~debug-mode~ this means that a lot + of diagnostic output will be appended to a file named ~tinmop.log~ + in the directory ~$HOME/.local/share/tinmop/~. + +* Files + + - ~$HOME/.local/share/tinmop/db.sqlite3~: the program database + - ~$HOME/.local/share/tinmop/client~: the program credentials to connect with the instance *keep private!* + - ~$HOME/.local/share/tinmop/tinmop.log~: this file is created only for debugging and should not be enabled in binary package distribution (see [[Contributing]]). + - ~/etc/tinmop/default-theme.conf~: default visual style + - ~/etc/tinmop/shared.conf~: some default configuration not related to themes + - ~/etc/tinmop/init.lisp~: system wide configuration + - ~$HOME/.config/tinmop/init.lisp~: user configuration + - ~$HOME/.local/share/tinmop/main.conf~: user configuration (simple format) + * Privacy This program do not interact with no other computer other than the diff --git a/doc/tinmop.man b/doc/tinmop.man index f8e3718..3be6125 100644 --- a/doc/tinmop.man +++ b/doc/tinmop.man @@ -10,12 +10,12 @@ tinmop [OPTION]... .SH "Description" .PP -This document assumes basic knowledge of how mastodon works. More -information about this topic can be found on the +This document assumes basic knowledge of how mastodon works. More +information about this topic can be found on the official website (\fIhttps://docs.joinmastodon.org/\fP). .PP -Tinmop propose a terminal interface to to connect with Mastodon or +Tinmop propose a terminal interface to to connect with Mastodon or Pleroma social network .SH "Options" @@ -47,8 +47,8 @@ print program help and exit .SH "Usage" .PP -Users of Tinmop are expected to interact with the social network -using a terminal interface (TUI), The terminal screen layout is +Users of Tinmop supposed to interacts with the social network +using a terminal interface (TUI), The terminal screen layout is sketched below: .RS @@ -76,14 +76,14 @@ sketched below: The screen is subdivided in five window: .TP -\fBtag window\fP -shows the tag users subscribed for and available +\fBtag window \fP +shows the tag users subscribed for and available messages for each tag; .TP -\fBthreads window\fP -for a given timeline and folder (see \fIFolders\fP) show -the discussions saved in user's local database; +\fBthreads window \fP +for a given timeline and folder (see +\fIFolders\fP) show the discussions saved in user's local database; .TP \fBconversations window\fP @@ -98,35 +98,33 @@ show the body of the message selected in the tag window the window where the user instruct the software to perform commands .PP -The only way to interact with the program is using the keyboard. -There is a contextual help that appears when the user input data -that provide hints about commands and a quick help window that can -be shown by hitting \fC?\fP (if this keybinding has not been +The main way to interact with the program is using the keyboard. +There is a contextual help that appears when the user input data +that provide hints about commands and a quick help window that can +be shown by hitting \fC?\fP (if this keybinding has not been customized). .SS "Folders" .PP -A folder is an object to groups messages for each timeline an -arbitrary number of folder can be created, when the last message of +A folder is an object to groups messages for each timeline an +arbitrary number of folders can be created, when the last message of a folder is deleted the folder is deleted as well. .SH "Configuration" .PP -The configuration of tinmop is based on text files but there are +The configuration of tinmop is based on text files but there are available two different kind with different syntax and scope. .IP \(em 4 -a key value text files used to configure the access credential to -.PP +a key-value text files used to configure the access credential to server and visual theme of the program (simple configuration); .IP \(em 4 -common lisp source code. Used to write module (AKA plugin) and to -.PP +common lisp source code. Used to write module (AKA plugin) and to configure keybindings to interact with the software. .PP -The distribution of this software comes with a bunch of pre-backed +The distribution of this software comes with a bunch of pre-backed configuration files but user is expected to write a simple file with their credential to log into the server. @@ -138,7 +136,7 @@ This is a simple file with each entry in a single line that look like this: .nf \fC # a file can be included in another with this directive: -use "default-theme.conf" +use "shared.conf" # a line starting with a '#' is a comment # The server instance name @@ -152,9 +150,9 @@ username = username .RE .PP -Not incidentally the information in the example above are the +Not incidentally the information i the example above are the absolute minimum the user has to provide before starts the program: -the name you chose when you made the account on the server and the +the name you chose when you made the account on the server and the address of the server. .PP @@ -163,67 +161,56 @@ skipped by the program .PP The file with this credential are confidential and must be put into -user's home directory under the path -\fC/home/username/.local/share/tinmop/\fP. Probably the directory +user's home directory under the path +\fC$HOME/.local/share/tinmop/main.conf\fP. Probably the directory \fCtinmop\fP does not exists on user system, if it does not exists must be created manually. .PP -If the program was installed correctly two other files with simple -semantics are located in your system wide configuration directory -(usually \fC/etc/tinmop/\fP), please check these files for more -information, as are extensively commented. +If the program was installed correctly two other files with simple +semantics are located in your system wide configuration directory +(usually \fC/etc/tinmop/\fP), please check these files for more +information, as they are extensively commented. .SS "Lisp program" .PP -These files contains Common lisp (see \fIhttps://common-lisp.net\fP) -source code. And are used both as a way to configure the program +These files contains Common lisp (see \fIhttps://common-lisp.net/\fP) +source code. And are used both as a way to configure the program and to write module for tinmop itself. .PP -These files are the only way to configure program's keybindings: -sequence of pressing button to fire command commands (do not worry +These files are the only way to configure program's keybindings: +sequence of pressing button to fire command commands (do not worry it is not too difficult!). .PP -These files must be a valid Common Lisp program to allow the -program to even starts. Again this is actual source code that is -loaded end executed by the main program; be careful, do not copy -and paste code from untrusted sources as this could results in a +These files must be a valid Common Lisp program to allow the +program to even starts. Again this is actual source code that is +loaded end executed by the main program; be careful, do not copy +and paste code from untrusted sources as this could results in a \fBsevere\fP security damage. .PP -Again in the configuration directory there is a (commented) file -named \fCinit.lisp\fP that user can use as their starting point to -write their files. A custom init file (or other module files must -be located into the directory \fC/home/username/.local/share/tinmop/\fP -to be successfully loaded. +Again in the configuration directory there is a (commented) file +named \fCinit.lisp\fP that user can use as their starting point to +write their files. A custom init file, or other module files, must +be located into the directory \fC$HOME/.local/share/tinmop/\fP or +\fC$HOME/.config/tinmop/\fP (because, you know, data is code and code +is data) to be successfully loaded. .PP -However there is no need to write their own init file if user is +However there is no need to write their own init file if user is happy with the provided one by the package maintainers. .SH "First time start" .PP -After the configuration the program can be started but we are not -ready to join the network yet because tinmop need to be \fItrusted\fP by -the server. Just follows the instruction on screen to register the -application with your instance. This procedure should be followed -once. When the program starts for the first time (but please note +After the configuration the program can be started but we are not +ready to join the network yet because tinmop need to be \fItrusted\fP by +the server. Just follows the instruction on screen to register the +application with your instance. This procedure should be followed +once: when the program starts for the first time (but please note that there must be a file with valid credentials available). -.SH "Modules and scripts" -.PP -Users can write modules and scripts for tinmop, both are lisp -program so there is no artificial limiting to what they can do, the -only difference is that the script are loaded without the TUI so -they are useful for non interactive tasks. - -.PP -An example of module is the distributed file \fCinit.lisp\fP and users -can find a simple script to send a toot in the their system wide -documentation directory (sometimes: \fC/usr/share/doc/\fP). - .SH "How to get more help" .PP For help with mastodon visit the mastodon website. @@ -235,7 +222,7 @@ The program has an inline help (default binding for help is "?") Moreover you can have some useful hint at the program web page: .PP -\fIhttps://www.autistici.org/interzona/tinmop/\fP +[\fIhttps://www.autistici.org/interzona/tinmop/\fP] .SH "BUGS" .PP @@ -255,6 +242,40 @@ https://notabug.org/cage/tinmop/ \fBat\fP \fIcode repository\fP. .PP See also the file CONTRIBUTE.org +.SS "Debug mode" +.PP +If you decomment the line: + +.RS +.nf +\fC;;(push :debug-mode *features*) +\fP +.fi +.RE + +.PP +The program will be compiled in \fCdebug\-mode\fP this means that a lot +of diagnostic output will be appended to a file named \fCtinmop.log\fP +in the directory \fC$HOME/.local/share/tinmop/\fP. + +.SH "Files" +.IP \(em 4 +\fC$HOME/.local/share/tinmop/db.sqlite3\fP: the program database +.IP \(em 4 +\fC$HOME/.local/share/tinmop/client\fP: the program credentials to connect with the instance \fBkeep private!\fP +.IP \(em 4 +\fC$HOME/.local/share/tinmop/tinmop.log\fP: this file is created only for debugging and should not be enabled in binary package distribution (see \fIContributing\fP). +.IP \(em 4 +\fC/etc/tinmop/default\-theme.conf\fP: default visual style +.IP \(em 4 +\fC/etc/tinmop/shared.conf\fP: some default configuration not related to themes +.IP \(em 4 +\fC/etc/tinmop/init.lisp\fP: system wide configuration +.IP \(em 4 +\fC$HOME/.config/tinmop/init.lisp\fP: user configuration +.IP \(em 4 +\fC$HOME/.local/share/tinmop/main.conf\fP: user configuration (simple format) + .SH "Privacy" .PP This program do not interact with no other computer other than the @@ -269,4 +290,13 @@ for details. .SH "Acknowledgment" .PP -See file LICENSES.org +My deep thanks to the folks that provided us with wonderful SBCL and +Common lisp libraries. + +.PP +In particular i want to thanks the authors of the libraries Croatoan and Tooter +for their help when I started to develop this program. + +.PP +There are more people i borrowed code and data from, they are mentioned +in the file LINCENSES.org diff --git a/po/it.po b/po/it.po index 9b092f0..1fa3924 100644 --- a/po/it.po +++ b/po/it.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: tinmop 0.0.1\n" "Report-Msgid-Bugs-To: https://notabug.org/cage/tinmop/\n" -"POT-Creation-Date: 2020-05-08 15:15+0200\n" -"PO-Revision-Date: 2020-05-07 16:32+0200\n" +"POT-Creation-Date: 2020-05-09 12:40+0200\n" +"PO-Revision-Date: 2020-05-09 12:41+0200\n" "Last-Translator: cage \n" "Language-Team: Italian\n" "Language: it\n" @@ -118,7 +118,7 @@ msgstr "SCRIPT-FILE" msgid "Error: command ~a not found" msgstr "Errore: comando ~a non trovato" -#: src/conditions.lisp:67 src/conditions.lisp:71 src/db.lisp:2113 +#: src/conditions.lisp:67 src/conditions.lisp:71 src/db.lisp:2130 #: src/message-rendering-utils.lisp:132 src/message-rendering-utils.lisp:166 #: src/message-rendering-utils.lisp:171 msgid "unknown" @@ -258,7 +258,7 @@ msgstr "Scritto da: " #: src/message-rendering-utils.lisp:211 msgid "Boosted: " -msgstr "Rilanciato per:" +msgstr "Rilanciato per: " #: src/message-rendering-utils.lisp:215 msgid "Date: " @@ -272,7 +272,7 @@ msgstr "Messaggi" msgid "modeline" msgstr "modeline" -#: src/modules.lisp:33 +#: src/modules.lisp:37 #, lisp-format msgid "" "Unrecoverable error: file ~a not found in any of the directory ~a ~a ~a ~a" @@ -316,7 +316,12 @@ msgstr "Scaricati nuovi messaggi per l'etichetta ~a." #: src/resources-utils.lisp:55 #, lisp-format msgid "Unrecoverable error: cannot find ~s in either ~s or ~s." -msgstr "Errore non rimediabile: non trovo ~s né in ~s né ~s." +msgstr "Errore non rimediabile: non trovo il file ~s né in ~s né ~s." + +#: src/resources-utils.lisp:72 +#, lisp-format +msgid "Unrecoverable error: cannot find file ~s." +msgstr "Errore non rimediabile: non trovo il file ~s." #: src/sending-message.lisp:114 msgid "none" @@ -376,21 +381,21 @@ msgstr "Oggetto mancante" msgid "No message with index ~a exists." msgstr "Nessun messaggio esiste alla posizione ~a." -#: src/thread-window.lisp:838 src/thread-window.lisp:872 +#: src/thread-window.lisp:852 src/thread-window.lisp:886 #, lisp-format msgid "No next message that contains ~s exists." msgstr "Nessun messaggio successivo che contenga ~s esiste." -#: src/thread-window.lisp:844 src/thread-window.lisp:878 +#: src/thread-window.lisp:858 src/thread-window.lisp:892 #, lisp-format msgid "No previous message that contains ~s exists." msgstr "Nessun messaggio precedente che contenga ~s esiste." -#: src/thread-window.lisp:894 +#: src/thread-window.lisp:908 msgid "No others unread messages exist." msgstr "Non ci sono altri messaggi non letti." -#: src/thread-window.lisp:905 +#: src/thread-window.lisp:919 msgid "Threads" msgstr "Discussioni" diff --git a/po/tinmop.pot b/po/tinmop.pot index 7dfe4b3..15601c2 100644 --- a/po/tinmop.pot +++ b/po/tinmop.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: tinmop 0.0.1\n" "Report-Msgid-Bugs-To: https://notabug.org/cage/tinmop/\n" -"POT-Creation-Date: 2020-05-08 15:15+0200\n" +"POT-Creation-Date: 2020-05-09 12:40+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -114,7 +114,7 @@ msgstr "" msgid "Error: command ~a not found" msgstr "" -#: src/conditions.lisp:67 src/conditions.lisp:71 src/db.lisp:2113 +#: src/conditions.lisp:67 src/conditions.lisp:71 src/db.lisp:2130 #: src/message-rendering-utils.lisp:132 src/message-rendering-utils.lisp:166 #: src/message-rendering-utils.lisp:171 msgid "unknown" @@ -265,7 +265,7 @@ msgstr "" msgid "modeline" msgstr "" -#: src/modules.lisp:33 +#: src/modules.lisp:37 #, lisp-format msgid "" "Unrecoverable error: file ~a not found in any of the directory ~a ~a ~a ~a" @@ -307,6 +307,11 @@ msgstr "" msgid "Unrecoverable error: cannot find ~s in either ~s or ~s." msgstr "" +#: src/resources-utils.lisp:72 +#, lisp-format +msgid "Unrecoverable error: cannot find file ~s." +msgstr "" + #: src/sending-message.lisp:114 msgid "none" msgstr "" @@ -363,21 +368,21 @@ msgstr "" msgid "No message with index ~a exists." msgstr "" -#: src/thread-window.lisp:838 src/thread-window.lisp:872 +#: src/thread-window.lisp:852 src/thread-window.lisp:886 #, lisp-format msgid "No next message that contains ~s exists." msgstr "" -#: src/thread-window.lisp:844 src/thread-window.lisp:878 +#: src/thread-window.lisp:858 src/thread-window.lisp:892 #, lisp-format msgid "No previous message that contains ~s exists." msgstr "" -#: src/thread-window.lisp:894 +#: src/thread-window.lisp:908 msgid "No others unread messages exist." msgstr "" -#: src/thread-window.lisp:905 +#: src/thread-window.lisp:919 msgid "Threads" msgstr "" diff --git a/src/modules.lisp b/src/modules.lisp index cd62b91..abc5a9b 100644 --- a/src/modules.lisp +++ b/src/modules.lisp @@ -17,6 +17,10 @@ (in-package :modules) +(defun load-sys-module (path) + (let ((file (get-sys-config-file path))) + (load file :verbose nil :print nil))) + (defun load-module (path) (flet ((%load (file) (load file :verbose nil :print nil))) diff --git a/src/package.lisp b/src/package.lisp index 3f25e39..8fd54e7 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -375,6 +375,7 @@ :return-home-filename :return-system-filename :get-config-file + :get-sys-config-file :get-data-file)) (defpackage :crypto-utils @@ -1881,6 +1882,7 @@ :ui-goodies) (:shadowing-import-from :resources-utils :init) (:export + :load-sys-module :load-module)) (defpackage :scripts diff --git a/src/resources-utils.lisp b/src/resources-utils.lisp index 70b758d..9385f82 100644 --- a/src/resources-utils.lisp +++ b/src/resources-utils.lisp @@ -65,5 +65,12 @@ (defun get-config-file (path) (get-resource-file +sys-conf-dir+ (home-confdir) path)) +(defun get-sys-config-file (path &optional (system-dir +sys-conf-dir+)) + (let ((system-file (fs:cat-parent-dir system-dir path))) + (if (fs:file-exists-p system-file) + system-file + (let ((msg (_ "Unrecoverable error: cannot find file ~s."))) + (error (format nil msg system-file)))))) + (defun get-data-file (path) (get-resource-file +sys-data-dir+ (home-datadir) path))