From 9f5a7612d25381e1f402f954945a9c405a4325d7 Mon Sep 17 00:00:00 2001 From: Steve Youngs Date: Mon, 15 Jun 2015 10:24:09 +1000 Subject: [PATCH] Add convenience function for updating #sxemacs topic version string. * 16-riece-sy.el (sy-riece-get-sxemacs-topic-version): New. Returns the "version" section of #sxemacs topic. * 16-riece-sy.el (sy-riece-sxemacs-topic-version-update): New. Updates the "version" section of the #sxemacs topic. Signed-off-by: Steve Youngs --- 16-riece-sy.el | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/16-riece-sy.el b/16-riece-sy.el index 82fc4d0..086e36b 100644 --- a/16-riece-sy.el +++ b/16-riece-sy.el @@ -5,7 +5,7 @@ ;; Author: Steve Youngs ;; Maintainer: Steve Youngs ;; Created: <2007-12-02> -;; Time-stamp: +;; Time-stamp: ;; Download: ;; HTMLised: ;; Git Repo: git clone http://git.sxemacs.org/syinit @@ -557,7 +557,12 @@ See `riece-me:command-complete-user'." (add-hook 'riece-command-mode-hook #'(lambda () - (local-set-key [iso-left-tab] #'sy-riece-complete-user-backwards))) + ;; Define a few keys here so they don't have the `C-c' prefix + (local-set-key [iso-left-tab] #'sy-riece-complete-user-backwards) + (local-set-key [(super next)] #'riece-command-user-list-scroll-up) + (local-set-key [(super prior)] #'riece-command-user-list-scroll-down) + (local-set-key [(hyper next)] #'riece-command-scroll-up) + (local-set-key [(hyper prior)] #'riece-command-scroll-down))) (defun riece-me:command-complete-user (&optional reverse) "Like `riece-command-complete-user' but restrict to current chan. @@ -626,6 +631,32 @@ biff list." (message "Channel: %s added to riece-biff channel list." (riece-identity-prefix riece-current-channel)))) +(defun sy-riece-get-sxemacs-topic-version () + "Return the \"version\" section of #sxemacs topic." + (let* ((topic (riece-with-server-buffer + (riece-identity-server riece-current-channel) + (riece-channel-get-topic "#sxemacs"))) + (ver (third (split-string-by-char topic ?\ )))) + ver)) + +(defun sy-riece-sxemacs-topic-version-update (&optional newver) + "*Updates the \"version\" section of #sxemacs topic with NEWVER. +With a prefix arg, prompt for the new version string." + (interactive "P") + (let* ((oldver (sy-riece-get-sxemacs-topic-version)) + (gitver (substring (shell-command-to-string + "( cd ${SXEWD}; git describe master )") + 0 -1)) + (newver (or (and current-prefix-arg + (read-string "New Version: " + sxemacs-git-version nil + sxemacs-git-version)) + gitver)) + (chan (riece-identity-prefix riece-current-channel))) + (unless (string= chan "#sxemacs") + (error 'invalid-argument "Wrong channel" chan)) + (riece-command-send-message + (format ",topic change 1 s/%s/%s/" oldver newver) nil))) ;; Define keys for those functions. (define-key riece-command-map (kbd "C-c C") #'sy-riece-clear-unread-chans) @@ -641,6 +672,7 @@ biff list." (define-key riece-command-map (kbd "C-c b") #'sy-riece-add-rem-biff-channel) (define-key riece-command-map (kbd "C-c ?") #'sy-riece-think) (define-key riece-command-map (kbd "C-c R") #'sy-riece-reverse) +(define-key riece-command-map (kbd "C-c T") #'sy-riece-sxemacs-topic-version-update) (define-key riece-command-map (kbd "C-c U") #'sy-riece-sxe-uptime) (define-key riece-command-map [a] #'sy-riece-say-all-purpose) -- 2.25.1