DISQUS

Valkertown Blog: Emacs Denting mode for laconicas (incliding identi.ca)

  • Matt Price · 10 months ago
    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 peer\n")
    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
  • deepspawn · 10 months ago
    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. For a quick fix I 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 limit(so maybe just setting up the update interval to a larger number might fix it)

    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:

    (defun multi-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)))
  • titaniumbones · 10 months ago
    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
  • deepspawn · 10 months ago
    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.
  • Gabriel Saldana · 10 months ago
    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.
  • deepspawn · 10 months ago
    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.