identica-mode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Identica-mode-devel] [PATCH] Improve identica-remote-user-timeline


From: identica-mode-devel
Subject: [Identica-mode-devel] [PATCH] Improve identica-remote-user-timeline
Date: Wed, 28 May 2014 19:19:33 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi there!

Not sure if anyone else is using identica-mode after the fall of
identica itself, but I am (for my own instance of GNU Social, of
course!).

Anyway, I intend to start hacking more on the code now that I'm back to
the stage.  Of course I'd appreciate any kind of help from the existing
developers (Gabriel?), assuming you have time.

Well, let's begin...  This simple patch implements something that I
missed from the start with identica-mode: the ability to specify a
remote user in the minibuffer in order to see his/her timeline.
Currently, C-c C-o only works if you have a post from the remote user in
your timeline, and you put the point on top of his/her nick.  With this
patch, you can specify the nickname using "address@hidden" format.

I did a simple test and it worked fine.

OK to apply?

Thanks,

-- 
Sergio
GPG key ID: 65FC5E36
Please send encrypted e-mail if possible
http://blog.sergiodj.net/

diff --git a/identica-mode.el b/identica-mode.el
index 1cd3d5f..3279b0f 100644
--- a/identica-mode.el
+++ b/identica-mode.el
@@ -4,7 +4,7 @@
 ;; Copyright (C) 2009 Bradley M. Kuhn
 
 ;; Author: Gabriel Saldana <address@hidden>
-;; Last update: 2011-10-20
+;; Last update: 2014-05-28
 ;; Version: 1.3.1
 ;; Keywords: identica web
 ;; URL: http://blog.gabrielsaldana.org/identica-mode-for-emacs/
@@ -24,6 +24,7 @@
 ;;     Aidan Gauland <address@hidden> (variable scope code cleanup)
 ;;     Joel J. Adamson <address@hidden> Added countdown minibuffer-prompt style
 ;;     Kevin Granade <address@hidden> (OAuth support)
+;;     Sergio Durigan Junior <address@hidden> (improve 
identica-remote-user-timeline)
 
 ;;; Commentary:
 
@@ -2065,7 +2066,7 @@ If nil, will ask for username in minibuffer."
     (setq identica-method (concat "conversation/" context-id)))
   (identica-get-timeline identica-remote-server))
 
-(defun identica-remote-user-timeline ()
+(defun identica-remote-user-timeline-at-point ()
   (interactive)
   (let* ((profile (get-text-property (point) 'profile-url))
          (username (get-text-property (point) 'username))
@@ -2080,6 +2081,24 @@ If nil, will ask for username in minibuffer."
     (setq identica-method (concat "user_timeline/" username))
     (identica-get-timeline server)))
 
+(defun identica-remote-user-timeline-user (resource)
+  (interactive)
+  (let* ((user (if (string-match "\\(.*\\)@\\(.*\\)" resource)
+               (match-string 1 resource)))
+        (host (match-string 2 resource)))
+    (setq identica-method-class "statuses")
+    (setq identica-method (concat "user_timeline/" user))
+    (identica-get-timeline host)))
+
+(defun identica-remote-user-timeline (&optional resource)
+  (interactive)
+  (unless resource
+    (setq resource (read-from-minibuffer "Provide the address@hidden for the 
timeline [Empty for user at point]: "
+                                    nil nil nil nil nil t)))
+  (if (string-equal resource "")
+      (identica-remote-user-timeline-at-point)
+    (identica-remote-user-timeline-user resource)))
+
 (defun identica-current-timeline (&optional count)
   "Load newer notices, with an argument load older notices, and with a numeric 
argument load that number of notices."
   (interactive "P")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]