Skip to content

Commit

Permalink
disable tinyurl when mm-url doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
hayamiz committed Dec 28, 2009
1 parent 0205a8b commit 3a1d49d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -147,6 +147,7 @@
2009-12-15 haya <haya@starfish.unicus.ddo.jp>

* twittering-mode.el (twittering-status-not-blank-p): fix invalid escape sequence
(twittering-tinyurl-replace-at-point): disabled when 'mm-url' doesn't exist.

2009-12-12 Alberto Garcia <agarcia@igalia.com>

Expand Down
6 changes: 5 additions & 1 deletion twittering-mode.el
Expand Up @@ -45,6 +45,9 @@
(require 'cl)
(require 'xml)
(require 'parse-time)
(when (< emacs-major-version 22)
(require 'un-define)
(set-terminal-coding-system 'utf-8))

(defconst twittering-mode-version "0.9")
(defconst twittering-max-number-of-tweets-on-retrieval 200
Expand Down Expand Up @@ -1512,14 +1515,15 @@ If STATUS-DATUM is already in DATA-VAR, return nil. If not, return t."
(defun twittering-tinyurl-replace-at-point ()
"Replace the url at point with a tiny version."
(interactive)
(when (featurep 'mm-url)
(let ((url-bounds (bounds-of-thing-at-point 'url)))
(when url-bounds
(let ((url (twittering-tinyurl-get (thing-at-point 'url))))
(when url
(save-restriction
(narrow-to-region (car url-bounds) (cdr url-bounds))
(delete-region (point-min) (point-max))
(insert url)))))))
(insert url))))))))

;;;
;;; Commands
Expand Down

0 comments on commit 3a1d49d

Please sign in to comment.