I guess one of the main advantages that laconica has is being twitter compatible because if you have the source you can get a twitter only app to work on any laconica instance, so I found the twittering mode for emacs here:
http://lambdarepos.svnrepository.com/share/trac.cgi/browser/lang/elisp/twittering-mode
Then I decided to port it to laconica so I could use it to post to Brainbird, which is my own laconica instance.
I added the denting group for customization and I would like to use a password system like the one that weblogger.el uses. Now you can set the laconica instance you want to use by setting the laconica-instance variable.
The bindigns as always with emacs modes are the most sexy part, so here they are. I added none Im just posting this to make it easier for the interested to get to know which they are.
-
(define-key km "\C-c\C-f" denting-friends-timeline)
-
(define-key km "\C-c\C-s" denting-update-status-interactive)
-
(define-key km "\C-c\C-e" denting-erase-old-statuses)
-
(define-key km "\C-m" denting-enter)
-
(define-key km "\C-c\C-l" denting-update-lambda)
-
(define-key km [mouse-1] denting-click)
-
(define-key km "\C-c\C-v" denting-view-user-page)
-
;; (define-key km "j" next-line)
-
;; (define-key km "k" previous-line)
-
(define-key km "j" denting-goto-next-status)
-
(define-key km "k" denting-goto-previous-status)
-
(define-key km "l" forward-char)
-
(define-key km "h" backward-char)
-
(define-key km "0" beginning-of-line)
-
(define-key km "^" beginning-of-line-text)
-
(define-key km "$" end-of-line)
-
(define-key km "n" denting-goto-next-status-of-user)
-
(define-key km "p" denting-goto-previous-status-of-user)
-
(define-key km [backspace] backward-char)
-
(define-key km "G" end-of-buffer)
-
(define-key km "H" beginning-of-buffer)
-
(define-key km "i" denting-icon-mode)
-
(define-key km "s" denting-scroll-mode)
-
(define-key km "t" denting-toggle-proxy)
-
(define-key km "\C-c\C-p" denting-toggle-proxy)
The icon mode is nice, since it displays in recent emacs the avatars ofthe laconicats youre following. You can download the denting-mode.el here:
http://hg.valkertown.org/denting-mode.hg
If you hit one of the many bugs this code might have, please comment here and I might try to solve it. But bear with me Im not an usual emacs lisp programmer and this quialifies more to a hack than a proper release.
Tags: View Comments







Hi,
thanks for this! it's great to have a denting mode. at first it worked great for me, but for some reaosn now i keep getting an xml error that i don't understand at all. I tried twittering mode and do not get a similar error with them. Here's the backtrace:
Debugger entered–Lisp error: (error “XML: (Not Well-Formed) Invalid end tag (expecting in_reply_to_user_id) at pos 8365″)
signal(error (“XML: (Not Well-Formed) Invalid end tag (expecting in_reply_to_user_id) at pos 8365″))
error(“XML: (Not Well-Formed) Invalid end tag (expecting %s) at pos %d” “in_reply_to_user_id” 8365)
xml-parse-tag(nil nil)
xml-parse-tag(nil nil)
xml-parse-tag(nil nil)
xml-parse-tag(nil nil)
xml-parse-region(350 16256)
(let ((content …)) (xml-parse-region (+ … …) (point-max)))
(let ((content …)) (let (…) (xml-parse-region … …)))
(save-excursion (set-buffer buffer) (let (…) (let … …)))
denting-get-response-body()
(let ((header …) (body …) (status nil)) (if (string-match “HTTP/1.[01] \([a-z0-9 ]+\)
?n” header) (progn … …) (message “Failure: Bad http response.”)))
denting-http-get-default-sentinel(#<process network-connection-process> “connection broken by remote peern”)
recursive-edit()
do you ever see anything like this, or have any debugging suggestions? i'd just written a wrapper function that double-poststo twitter and identi.ca, so now i'm bummed it's not working! thanks,
matt
Yes I have the same problem, it's a bit annoying but totally harmless, it's just the xml parser failing from time to time to parse the laconica response. IAs a quick fix only can think about shutting the hell out of it by capturing the error. On the proper way to solve the problem, it would require to figure out why the twitter/identica serves bad xml and correct it. My bets are on the api limits.
Also you can avoid the wrapper function by using the identi.cas twitter bridge on your account settings. If you really want that function I think it would be something like this:
<pre lang=”lisp”>
(defun denting-update-status-from-minibuffer (&optional init-str)
(if (null init-str) (setq init-str “”))
(let ((status init-str))
(setq status (read-from-minibuffer “status: ” status nil nil nil nil t))
(denting-update-status-if-not-blank status)
(twittering-update-status-if-not-blank status)))
</pre>
hey deepspawn, what do you mean by “shutting the hell out of it by capturing the error” — sorry, not really a coder, don't quite get what you mean.
not sure it'sthe api limit since it now seems to come up every time, not just occasionally. though now i think of it, gwibber was up on this machine as well, will shut it down and try in a few minutes.
my wrapper funciton looks a lot like the one you built, though yours is a little bit better. thanks! — matt
Sorry for taking so long, well It's not so hard
line 661 of current denting-mode.el
648 (defun denting-http-post-default-sentinel (proc stat &optional suc-msg)
649
650 (condition-case err-signal
651 (let ((header (denting-get-response-header))
652 ;; (body (denting-get-response-body)) not used now.
653 (status nil))
654 (string-match “HTTP/1.1 \([a-z0-9 ]+\)r?n” header)
655 (setq status (match-string-no-properties 1 header))
656 (case-string status
657 ((“200 OK”)
658 (message (if suc-msg suc-msg “Success: Post”)))
659 (t (message status)))
660 )
661 (error (message (prin1-to-string err-signal))))
662 )
You can replace it with:
(error (message “Failed”)))
You will replace the annoying message for a brief “Failed” message, it will not solve the issue but at least will not bug you with the full error. I will keep the full error printing for now, since maybe I can do a proper fix of the problem.
Well that isn’t really necessary now, thanks from the patch I got from Christian Cheng it just fixes de problem not just silence it.
hg.valkertown.org/denting-mode.hg
hey, I just found out about denting-mode. I made my own port of twittering-mode called identica-mode a few months ago http://blog.nethazard.net/identica-mode-for-emacs I've added support for tags and groups and a global posting shortcut, maybe you can find it useful.
I'm having the same trouble with the xml parsing thing. Have you been able to fix it? The problem is that when it fetches the feed, the xml has some weird char codes inside the xml tag, thus breaking the parsing. I reported this behavior to laconica developers, but they claim their feed is okay. Twitter's feed has no problems though.
Hello, I had the very same problem but Christian Cheng sent me a patch which solves the issue. I did my work without proper search first so I duplicated a lot of your efforts and I did a merge with your code few days ago so denting-mode has most of the features you did implement. I don't know if you updated the code recently but I will check again the diffs to merge your work in.
hey, I just found out about denting-mode. I made my own port of twittering-mode called identica-mode a few months ago http://blog.nethazard.net/identica-mode-for-emacs I've added support for tags and groups and a global posting shortcut, maybe you can find it useful.
I'm having the same trouble with the xml parsing thing. Have you been able to fix it? The problem is that when it fetches the feed, the xml has some weird char codes inside the xml tag, thus breaking the parsing. I reported this behavior to laconica developers, but they claim their feed is okay. Twitter's feed has no problems though.
Hello, I had the very same problem but Christian Cheng sent me a patch which solves the issue. I did my work without proper search first so I duplicated a lot of your efforts and I did a merge with your code few days ago so denting-mode has most of the features you did implement. I don't know if you updated the code recently but I will check again the diffs to merge your work in.