diff options
| author | Deniz Dogan | 2010-06-03 11:07:49 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2010-06-03 11:07:49 -0400 |
| commit | c62bf05a3723508124eda3bc4e208b112520eaad (patch) | |
| tree | f315cb2706b3ff858fc35065c12966c012024c2a | |
| parent | 72c02b8ad5b44df1c59c8ed4b1f906219a8448b2 (diff) | |
| download | emacs-c62bf05a3723508124eda3bc4e208b112520eaad.tar.gz emacs-c62bf05a3723508124eda3bc4e208b112520eaad.zip | |
* lisp/net/rcirc.el (rcirc-sort-nicknames): New custom.
(rcirc-nickname<, rcirc-sort-nicknames-join): New funs.
(rcirc-handler-366): Use them.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/net/rcirc.el | 42 |
2 files changed, 47 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ece74b3ca02..05904bef28e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-06-03 Deniz Dogan <deniz.a.m.dogan@gmail.com> | ||
| 2 | |||
| 3 | * net/rcirc.el (rcirc-sort-nicknames): New custom. | ||
| 4 | (rcirc-nickname<, rcirc-sort-nicknames-join): New funs. | ||
| 5 | (rcirc-handler-366): Use them. | ||
| 6 | |||
| 1 | 2010-06-03 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2010-06-03 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | Split smie-indent-calculate into more manageable chunks. | 9 | Split smie-indent-calculate into more manageable chunks. |
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index e30249f82c6..ba2d3f130c6 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el | |||
| @@ -281,6 +281,11 @@ Called with 5 arguments, PROCESS, SENDER, RESPONSE, TARGET and TEXT." | |||
| 281 | :type 'hook | 281 | :type 'hook |
| 282 | :group 'rcirc) | 282 | :group 'rcirc) |
| 283 | 283 | ||
| 284 | (defcustom rcirc-sort-nicknames nil | ||
| 285 | "If non-nil, sorts nickname listings." | ||
| 286 | :type 'boolean | ||
| 287 | :group 'rcirc) | ||
| 288 | |||
| 284 | (defcustom rcirc-always-use-server-buffer-flag nil | 289 | (defcustom rcirc-always-use-server-buffer-flag nil |
| 285 | "Non-nil means messages without a channel target will go to the server buffer." | 290 | "Non-nil means messages without a channel target will go to the server buffer." |
| 286 | :type 'boolean | 291 | :type 'boolean |
| @@ -1650,6 +1655,38 @@ if NICK is also on `rcirc-ignore-list-automatic'." | |||
| 1650 | rcirc-ignore-list | 1655 | rcirc-ignore-list |
| 1651 | (delete nick rcirc-ignore-list)))) | 1656 | (delete nick rcirc-ignore-list)))) |
| 1652 | 1657 | ||
| 1658 | (defun rcirc-nickname< (s1 s2) | ||
| 1659 | "Compares two IRC nicknames. Operator nicknames (@) are | ||
| 1660 | considered less than voiced nicknames (+). Any other nicknames | ||
| 1661 | are greater than voiced nicknames. | ||
| 1662 | |||
| 1663 | Returns t if S1 is less than S2, otherwise nil. | ||
| 1664 | |||
| 1665 | The comparison is case-insensitive." | ||
| 1666 | (setq s1 (downcase s1) | ||
| 1667 | s2 (downcase s2)) | ||
| 1668 | (let* ((s1-op (eq ?@ (string-to-char s1))) | ||
| 1669 | (s2-op (eq ?@ (string-to-char s2)))) | ||
| 1670 | (if s1-op | ||
| 1671 | (if s2-op | ||
| 1672 | (string< (substring s1 1) (substring s2 1)) | ||
| 1673 | t) | ||
| 1674 | (if s2-op | ||
| 1675 | nil | ||
| 1676 | (string< s1 s2))))) | ||
| 1677 | |||
| 1678 | (defun rcirc-sort-nicknames-join (input sep) | ||
| 1679 | "Takes a string of nicknames and returns the string with the | ||
| 1680 | nicknames sorted. | ||
| 1681 | |||
| 1682 | INPUT is a string containing nicknames separated by SEP. | ||
| 1683 | |||
| 1684 | This function is non-destructive, sorting a copy of the input." | ||
| 1685 | (let ((parts (split-string input sep t)) | ||
| 1686 | copy) | ||
| 1687 | (setq copy (sort parts 'rcirc-nickname<)) | ||
| 1688 | (mapconcat 'identity copy sep))) | ||
| 1689 | |||
| 1653 | ;;; activity tracking | 1690 | ;;; activity tracking |
| 1654 | (defvar rcirc-track-minor-mode-map (make-sparse-keymap) | 1691 | (defvar rcirc-track-minor-mode-map (make-sparse-keymap) |
| 1655 | "Keymap for rcirc track minor mode.") | 1692 | "Keymap for rcirc track minor mode.") |
| @@ -2554,7 +2591,10 @@ keywords when no KEYWORD is given." | |||
| 2554 | (buffer (rcirc-get-temp-buffer-create process channel))) | 2591 | (buffer (rcirc-get-temp-buffer-create process channel))) |
| 2555 | (with-current-buffer buffer | 2592 | (with-current-buffer buffer |
| 2556 | (rcirc-print process sender "NAMES" channel | 2593 | (rcirc-print process sender "NAMES" channel |
| 2557 | (buffer-substring (point-min) (point-max)))) | 2594 | (let ((content (buffer-substring (point-min) (point-max)))) |
| 2595 | (if rcirc-sort-nicknames | ||
| 2596 | (rcirc-sort-nicknames-join content " ") | ||
| 2597 | content)))) | ||
| 2558 | (kill-buffer buffer))) | 2598 | (kill-buffer buffer))) |
| 2559 | 2599 | ||
| 2560 | (defun rcirc-handler-433 (process sender args text) | 2600 | (defun rcirc-handler-433 (process sender args text) |