--- clients/emacs/bbj.el | 211 +++++++++++++++++++++++++++---------------- 1 file changed, 132 insertions(+), 79 deletions(-) diff --git a/clients/emacs/bbj.el b/clients/emacs/bbj.el index 2602ffe..626682a 100644 --- a/clients/emacs/bbj.el +++ b/clients/emacs/bbj.el @@ -135,7 +135,7 @@ or can be ommitted to send no data." (condition-case nil (setq json (json-read)) (error - (user-error "BBJ response error")))) + (user-error "Error de respuesta BBJ")))) (case (setq error (alist-get 'error json) edesc (alist-get 'description error) @@ -191,37 +191,37 @@ You can restore anon status on demand by using `bbj-logout'" (let ((bbj-noheaders t) check done) (setq bbj-user (bbj-sane-value - "(BBJ Username)> " + "(Nombre de usuario BBJ)> " "user_name")) (cond ((bbj-request! 'user_is_registered 'target_user bbj-user) (if (bbj-request! 'check_auth 'target_user bbj-user 'target_hash (bbj-sethash)) - (message "Logged in as %s!" bbj-user) + (message "¡Sesión iniciada como %s!" bbj-user) (setq bbj-hash nil) - (if (y-or-n-p (format "Invalid credentials for %s. Try again? " bbj-user)) + (if (y-or-n-p (format "Credenciales inválidas para %s. ¿Intentar de nuevo? " bbj-user)) (bbj-login) (setq bbj-user nil)))) - ((y-or-n-p (format "Register for BBJ as %s? " bbj-user)) + ((y-or-n-p (format "¿Registrar en BBJ como %s? " bbj-user)) (while (not done) (condition-case error-response (let* ((init (bbj-sethash - (format "(Select a password for %s)> " bbj-user))) + (format "(Selecciona una contraseña para %s)> " bbj-user))) (conf (bbj-sethash (if (equal init (secure-hash 'sha256 "")) - "(Confirm empty password)> " - "(Confirm it)> ")))) + "(Confirma contraseña vacía)> " + "(Confírmala)> ")))) (unless (equal init conf) - (error "Passwords do not match.")) + (error "Las contraseñas no coinciden.")) (bbj-request 'user_register 'user_name bbj-user 'auth_hash bbj-hash) - (message "Registered and logged in as %s!" bbj-user) + (message "¡Registrado y sesión iniciada como %s!" bbj-user) (setq done t)) (error - (unless (y-or-n-p (format "%s Try again? " (cadr error-response))) + (unless (y-or-n-p (format "%s ¿Intentar de nuevo? " (cadr error-response))) (setq done t bbj-user nil bbj-hash nil))))))))) @@ -231,7 +231,7 @@ You can restore anon status on demand by using `bbj-logout'" "Sets the user data back to nil so you can use BBJ as an anon" (interactive) (unless nomessage - (message "You're now set as an anon.")) + (message "Ahora eres anónimo.")) (setq bbj-user "anonymous" bbj-hash nil)) @@ -241,7 +241,7 @@ You can restore anon status on demand by using `bbj-logout'" Sets it globally and also returns it." (setq bbj-hash (secure-hash 'sha256 (read-from-minibuffer - (or prompt "(Password)> "))))) + (or prompt "(Contraseña)> "))))) ;;;; user navigation shit. a LOT of user navigation shit. ;;;; @@ -345,7 +345,7 @@ just hunts for a specific text property." (goto-char (point-min)) (when (not (setq p2 (bbj-next-pos (format ">>%s " id) nil 'head))) - (message "post %s not found" id)) + (message "post %s no encontrado" id)) (goto-char (or p2 p1)) (recenter t))))) @@ -389,21 +389,21 @@ is sent using C-c C-c." (interactive) (let ((params (case bbj-buffer-type (index - `("Composing a new thread (C-c C-c to send)" + `("Escribiendo nuevo hilo (C-c C-c para enviar)" (lambda () (let* ((message (bbj-consume-window (current-buffer))) (request (bbj-request 'thread_create 'body message - 'title ,(bbj-sane-value "(Title)> " "title")))) + 'title ,(bbj-sane-value "(Título)> " "title")))) (bbj-browse-index) - (message "thread submitted"))))) + (message "hilo publicado"))))) (thread - `("Replying to thread (C-c C-c to send)" + `("Respondiendo al hilo (C-c C-c para enviar)" (lambda () (let* ((message (bbj-consume-window (current-buffer))) (request (bbj-request 'thread_reply 'body message 'thread_id ,thread-id))) - (message "reply submitted") + (message "respuesta publicada") (bbj-enter-thread ,thread-id) (goto-char (point-max)) (bbj-point-to-post 'prev) @@ -415,7 +415,7 @@ is sent using C-c C-c." (defun bbj-compose-in-window (title callback &rest cbargs) "Create a new buffer, pop it, set TITLE as the header line, and assign CALLBACK to C-c C-c." - (let ((buffer (get-buffer-create "BBJ: Compose"))) + (let ((buffer (get-buffer-create "BBJ: Escribir"))) (pop-to-buffer buffer) (with-current-buffer buffer (erase-buffer) @@ -486,7 +486,7 @@ and renders the content in the current buffer." (concat "~" (alist-get 'user_name userdata) " ") 'face 'font-lock-keyword-face)) (insert (if (eq bbj-buffer-type 'index) - (propertize (format "@ %s\n%s replies; last active %s\n" + (propertize (format "@ %s\n%s respuestas; activo %s\n" (bbj-timestring (alist-get 'created post)) (alist-get 'reply_count post) (bbj-timestring (alist-get 'last_mod post))) @@ -541,61 +541,114 @@ maimed until it worked on emacs 24." "Displays the help text." (interactive) ;; yes lets embed this shit in the source code haha epic - (let ((help "hi this is help pleased to meet ye 8) - -Please note the keys described below apply to thread and index buffers, -not this help page. - -n, j, down arrow, and spacebar all move down by a whole post. -p, k, up arrow, and backspace go up, again by a whole post. - -for n/p/j/k, hold shift (or use caps lock if you're into that) to scroll up or -down by one exactly one line. You can also use shift with the arrow keys, and -space/backspace, but if you are using terminal emacs, your terminal emulator may -not work properly with these combos. - -The normal emacs paging and cursor movement keys (besides arrows) are not -affected, if you are already familiar with them. C-n goes down a line, C-p goes -up, C-v pages down, M-v pages up. (reminder: M means alt here in Emacs lala -land) The keyboard's dedicated paging keys will work too. - -Open a thread with enter, or the o key. - -The make-a-post keys are c and + (the plus key). If you are in the index, it -will make a new thread and prompt you at the minibuffer for a title and some -tags. If you dont want tags, just press enter again. If you're in a thread, this -will begin composing a new reply. - -In the composure window, press control-c twice to fire it off to the server. If -you would like to discard the post, you can kill or hide this buffer using the -standard emacs keys. C-x 4 0 will kill the buffer and the window. C-x 0 will -just hide the window. C-x k RET will kill the buffer but not the window. - -In addition to the composure keys, r is bound to insert a quote element for the -post at point after popping a reply window. Post quotes look like >>32, that is, -they are two angle brackets pointing at a number. They currently dont do -anything special. Later versions of the client will support navigation features -using them. r is not required to use these: you can also type them in yourself. - -Pressing e on a post will pop a new window to edit it, given that the post is -yours and is not older than 24 hours. Currently this returns the html-rendered -output of the markdown parser, which is quite clunky and i will fix that. But -pressing C-c C-c will update it for everyone with the new data. - -g or f5 will reload whatever buffer you are in, thread or index. If you are in a -thread, it will save whatever post your cursor is positioned at. Use this to -check for new messages. - -q will get out of a thread and back to the index. If you're on the index, it -will kill that too. If you've killed the index, you can get back using the -command alt+x bbj-browse-index (tab completion is available) - -The command names to log in, and browse to the index are bbj-login and -bbj-browse-index respectively. - -Thats about it for now. + (let ((help "hola esta es la ayuda un gustazo 8) + +Ten en cuenta que las teclas descritas abajo aplican a los buffers de hilo e +índice, no esta página de ayuda. + +Las teclas n, j, flecha abajo y barra espaciadora se mueven abajo un post +entero. p, k, flecha arriba y backspace se mueven arriba, igual, un post entero. + +Para n/p/j/k, mantén apretado shift (o usa bloq mayús si eres de esos) para +moverte arriba o abajo exactamente una línea. También puedes usar shift con tus +flechas, y espacio/backspace, pero si estás usando el Emacs de terminal, tu +emulador puede no funcionar propiamente con estos combos. + +El empaginado normal de emacs y las teclas de movimiento del cursor (salvo las +flechas) no se afectan, si ya estás familiarizado con ellas. C-n baja una +línea, C-p sube, C-v baja una página, M-v sube. (recordatorio: M significa alt +en Emacs la la land) Las teclas de empaginado dedicadas funcionarán también. + +Abre un hilo con enter, o con la tecla o. + +Las teclas para crear posts son c y + (la tecla más). Si estás en el índice, +hará un nuevo hilo y te enviará al minibuffer para un título y algunas +etiquetas. Si no quieres etiquetas, solo presiona enter de nuevo. Si estás en +un hilo, empezarás a escribir una nueva respuesta. + +En la ventana de escritura, presiona C-c dos veces para enviárselo al server. +Si quieres descartar el post, puedes matar o esconder este buffer usando las +teclas estándar de Emacs. C-x 4 0 matará el buffer y la ventana. C-x 0 +solamente esconderá la ventana. C-x k RET matará el buffer pero no la ventana. + +Además de las teclas para escribir, r está enlazado a insertar un elemento de +cita para el post apuntado después de mostrar la ventana de respuesta. Las +citas de posts se ven como >>32, esto es, son dos flechas \" mayor que\" +apuntando a un número. + +Presionar e en un post hará saltar una ventana para editarla, dado que el post +es tuyo y no tiene una edad mayor a 24 horas. Actualmente esto regresa la +salida renderizada en HTML del parser de Markdown, que es bastante tosco y lo +arreglaré. Pero presionar C-c C-c lo actualizará para todos con la nueva data. + +g o f5 recargarán cualquier buffer en el que estés, sea hilo o índice, si estás +en un hilo, guardará cualquier post que tenga apuntado tu cursor. Úsalo para +chequear nuevos mensajes. + +q sirve para salir de un hilo y volver al índice. Si estás en el índice, lo +matará también. Si has matado el índice, puedes volver usando M-x +bbj-browse-index (se puede autocompletar con tab) + +Los comandos para iniciar sesión y navegar el índice son bbj-login y +bbj-browse-index, respectivamente. + +Eso es todo por ahora. ")) - (let ((buffer (get-buffer-create "BBJ: Help")) +;hi this is help pleased to meet ye 8) +; +;Please note the keys described below apply to thread and index buffers, +;not this help page. +; +;n, j, down arrow, and spacebar all move down by a whole post. +;p, k, up arrow, and backspace go up, again by a whole post. +; +;for n/p/j/k, hold shift (or use caps lock if you're into that) to scroll up or +;down by one exactly one line. You can also use shift with the arrow keys, and +;space/backspace, but if you are using terminal emacs, your terminal emulator may +;not work properly with these combos. + +;The normal emacs paging and cursor movement keys (besides arrows) are not +;affected, if you are already familiar with them. C-n goes down a line, C-p goes +;up, C-v pages down, M-v pages up. (reminder: M means alt here in Emacs lala +;land) The keyboard's dedicated paging keys will work too. +; +;Open a thread with enter, or the o key. +; +;The make-a-post keys are c and + (the plus key). If you are in the index, it +;will make a new thread and prompt you at the minibuffer for a title and some +;tags. If you dont want tags, just press enter again. If you're in a thread, this +;will begin composing a new reply. +; +;In the composure window, press control-c twice to fire it off to the server. If +;you would like to discard the post, you can kill or hide this buffer using the +;standard emacs keys. C-x 4 0 will kill the buffer and the window. C-x 0 will +;just hide the window. C-x k RET will kill the buffer but not the window. +; +;In addition to the composure keys, r is bound to insert a quote element for the +;post at point after popping a reply window. Post quotes look like >>32, that is, +;they are two angle brackets pointing at a number. They currently dont do +;anything special. Later versions of the client will support navigation features +;using them. r is not required to use these: you can also type them in yourself. +; +;Pressing e on a post will pop a new window to edit it, given that the post is +;yours and is not older than 24 hours. Currently this returns the html-rendered +;output of the markdown parser, which is quite clunky and i will fix that. But +;pressing C-c C-c will update it for everyone with the new data. +; +;g or f5 will reload whatever buffer you are in, thread or index. If you are in a +;thread, it will save whatever post your cursor is positioned at. Use this to +;check for new messages. +; +;q will get out of a thread and back to the index. If you're on the index, it +;will kill that too. If you've killed the index, you can get back using the +;command alt+x bbj-browse-index (tab completion is available) +; +;The command names to log in, and browse to the index are bbj-login and +;bbj-browse-index respectively. +; +;Thats about it for now. + + (let ((buffer (get-buffer-create "BBJ: Ayuda")) (inhibit-read-only t)) (with-current-buffer buffer (erase-buffer) @@ -605,7 +658,7 @@ Thats about it for now. (use-local-map (copy-keymap text-mode-map)) (local-set-key (kbd "q") 'kill-buffer-and-window) (setq header-line-format - "Press q or C-x 4 0 to get out. Arrows can scroll." + "Presiona q o C-x 4 0 para salir. Las flechas sirven para moverse." buffer-read-only t)) (pop-to-buffer buffer) (ignore-errors @@ -650,7 +703,7 @@ Thats about it for now. (bbj-enter-thread ,thread-id) (bbj-seek-post ,post-id))))) - (bbj-compose-in-window "Editing post (including html) (C-c C-c to send)" callback) + (bbj-compose-in-window "Editando post (incluyendo html) (C-c C-c para enviar)" callback) (insert body) (goto-char (point-min)))) @@ -658,7 +711,7 @@ Thats about it for now. (defun bbj-browse-index () (interactive) (let* ((inhibit-read-only t) - (buffer (get-buffer-create "BBJ Index")) + (buffer (get-buffer-create "Índice BBJ")) (response (bbj-request 'thread_index)) (count 0)) (with-current-buffer buffer @@ -673,7 +726,7 @@ Thats about it for now. (incf count)) (bbj-postprocess) (setq header-line-format (format - "%d posts. g to refresh. Control+h then spacebar for help." + "%d posts. g para refrescar. para ayuda." count))) (switch-to-buffer buffer) (setq buffer-read-only t)))