Skip to content

Commit

Permalink
Changed minor mode name and key bindings
Browse files Browse the repository at this point in the history
* twittering-mode.el (twittering-assist-mode-*): renamed to
twittering-minor-mode-*
(twittering-minor-mode-map): new key bindings: C-c t *
  • Loading branch information
hayamiz committed Dec 23, 2009
1 parent 774337b commit 9fc8cfd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Expand Up @@ -51,6 +51,12 @@
(twittering-http-post-default-sentinel): use the same argument
format of http-get-default-sentinel

2009-12-18 Yuto Hayamizu <y.hayamizu@gmail.com>

* twittering-mode.el (twittering-assist-mode-*): renamed to
twittering-minor-mode-*
(twittering-minor-mode-map): new key bindings: C-c t *

2009-12-16 Yuto Hayamizu <y.hayamizu@gmail.com>

* twittering-mode.el (twittering-tinyurl-replace-at-point):
Expand Down
38 changes: 19 additions & 19 deletions twittering-mode.el
Expand Up @@ -2037,34 +2037,34 @@ return value of (funcall TO the-following-string the-match-data).
;;;; Minor mode for twittering everywhere
;;;;

(defvar twittering-assist-mode-map (make-sparse-keymap))
(defvar twittering-minor-mode-map (make-sparse-keymap))

(when twittering-assist-mode-map
(let ((km twittering-assist-mode-map))
(define-key km "\C-c\C-s" 'twittering-update-status-interactive)
(define-key km "\C-c\C-c" 'twittering-assist-update-status-from-region)
(define-key km "\C-c\C-l" 'twittering-assist-update-status-from-line)
(when twittering-minor-mode-map
(let ((km twittering-minor-mode-map))
(define-key km "\C-cts" 'twittering-update-status-interactive)
(define-key km "\C-ctr" 'twittering-minor-update-status-from-region)
(define-key km "\C-ctl" 'twittering-minor-update-status-from-line)
))

(define-minor-mode twittering-assist-mode
"A minor mode assisting you to twit everywhere"
nil " Tw" twittering-assist-mode-map
(define-minor-mode twittering-minor-mode
"A minor mode minoring you to twit everywhere"
nil " Tw" twittering-minor-mode-map
:group 'twittering-mode

(when twittering-assist-mode
(when twittering-minor-mode
(transient-mark-mode t))
twittering-assist-mode)
twittering-minor-mode)

(defun twittering-assist-mode-maybe ()
"Return t and enable twittering-assist-mode if `twittering-assist-mode' can be called on the current buffer."
(defun twittering-minor-mode-maybe ()
"Return t and enable twittering-minor-mode if `twittering-minor-mode' can be called on the current buffer."
(unless (minibufferp (current-buffer))
(twittering-assist-mode t)))
(twittering-minor-mode t)))

(define-global-minor-mode global-twittering-assist-mode
twittering-assist-mode twittering-assist-mode-maybe
(define-global-minor-mode global-twittering-minor-mode
twittering-minor-mode twittering-minor-mode-maybe
:group 'twittering-mode)

(defun twittering-assist-update-status-from-region (begin end)
(defun twittering-minor-update-status-from-region (begin end)
(interactive "r")
(if (< 140 (- end begin))
(message "More than 140 chars in the region")
Expand All @@ -2074,13 +2074,13 @@ return value of (funcall TO the-following-string the-match-data).
(status (concat str hashtag)))
(twittering-update-status-from-minibuffer status))))

(defun twittering-assist-update-status-from-line ()
(defun twittering-minor-update-status-from-line ()
(interactive)
(save-excursion
(let (begin end)
(beginning-of-line) (setq begin (point))
(end-of-line) (setq end (point))
(twittering-assist-update-status-from-region begin end))))
(twittering-minor-update-status-from-region begin end))))

(provide 'twittering-mode)
;;; twittering.el ends here

0 comments on commit 9fc8cfd

Please sign in to comment.