diff options
author | John Wiegley <johnw@newartisans.com> | 2016-02-03 23:56:08 -0800 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2016-02-03 23:56:08 -0800 |
commit | 0608bf1c3d91196bcf06a6da96243f0fac119089 (patch) | |
tree | d79a6c43cd10c681445b75f859545c9f88e41899 /lisp/erc | |
parent | 91ab66201cedbcd2e4e8533a7152f6736ad08731 (diff) | |
parent | ee7399792f865905d393df05c3d4e5ec309aa06c (diff) | |
download | emacs-0608bf1c3d91196bcf06a6da96243f0fac119089.tar.gz |
Merge from origin/emacs-25
ee73997 Make erc work better when encountering unknown prefix chars
b99141d Make erc completion case-insensitive again
66c4620 Make complection in erc use consistent casing
8c562b2 Make /QUIT in erc more robust
d93d2c5 Make tracking faces in Emacs work more reliably
af6ab7e Make shr not bug out on images on non-graphical displays
3311f40 Fix bookmark display widths
d90ab1e Fix typo in eww-make-unique-file-name
7f81825 Make it possible to TAB to input fields
a43a1dc Insert complete alt texts when images are disabled
56ed4e1 Allow eww text fields to grow
66b315c Make erc work when subword-mode is switched on
255b68f Fix IMAP doc example
91557f5 Quoting fixes in doc strings and diagnostics
2c0dc9f Fix warning message in hack-local-variables
504696d Etags: yet another improvement in Ruby tags
8784ebf Fix x-popup-menu on TTYs without a mouse
8b87ecb * lisp/emacs-lisp/map.el: Improvements to the docstring of the
pcase macro
6191003 Use pop-to-buffer-same-window in eww
fe321fd * autogen.sh: Revert all recent changes.
74ebd4a * make-dist: Updates related to nt/.
737193a * make-dist: Add modules/.
3696bf2 * make-dist: Update for super-special file that can't live in etc/.
a4278e2 Fix failure to compile ns-win.el in parallel builds
860da4d Fix names of tags generated for Ruby accessors
f6213ce Fix file-name recognition in 'etags'
e42e662 Change Ruby file names and extensions recognized by 'etags'
58bfb6a More improvements for Ruby support in 'etags'
c04e911 Add --git-config option to autogen.sh
5713466 Fix editing undo changes in eww fields
51362d6 Allow the user more control of popping up the eww window
ee0fbd8 Make eww-browse-url with new-window parameter work again
9c3142d Clean up eww code slightly
cb035f3 Don't insert nil faces in shr
4c3fae3 ; * lisp/progmodes/prolog.el: Remove some obsolete commentary.
93f2153 Improve the custom type of some user options.
9f60d7e Mark some risky calendar variables.
1d07dcd Highlight two additional SCSS keywords
ee8b466 Recommend enabling integrity-checking in git
e639e10 Some corrections in Elisp manual
d766ca8 Chatter when autogen.sh changes Git configuration
3b734e1 * org/org-compat.el (org-font-lock-ensure): Fix bogus test (bug#22399)
43cb9f8 Omit unnecessary history from Lisp intro
2fbd1da * etc/HISTORY: Add some more history, plus git tags.
c90e1b4 Improve elisp “Security Considerations” doc
cedd7ca autogen.sh now arranges for git to check hashes
86ce76b ; Fix ChangeLog.2 commit ID.
7b1d2b1 Fix (c & 040) typo in emergency escapes
a8273da Fix display of overlay strings with 'display' and 'box' property
fc48106 Fix imap-starttls-open
cdecbed Fix return value of imap-starttls-open
20c7e34 ; * etc/NEWS: Fix renamed command name
98bdbdb Correct reference to DARWIN_OS preprocessor symbol
b250d29 Spelling fix
b920a0e Spelling fixes
93b144b Pacify GCC on C library without glibc API
Diffstat (limited to 'lisp/erc')
-rw-r--r-- | lisp/erc/erc-backend.el | 28 | ||||
-rw-r--r-- | lisp/erc/erc-button.el | 16 | ||||
-rw-r--r-- | lisp/erc/erc-pcomplete.el | 8 | ||||
-rw-r--r-- | lisp/erc/erc-track.el | 3 | ||||
-rw-r--r-- | lisp/erc/erc.el | 21 |
5 files changed, 57 insertions, 19 deletions
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 4a2a12dd403..b413ee5a547 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -474,13 +474,39 @@ Currently this is called by `erc-send-input'." nil t)) (split-string (buffer-string) "\n")))) +(defun erc-forward-word () + "Moves forward one word, ignoring any subword settings. If no +subword-mode is active, then this is (forward-word)." + (skip-syntax-forward "^w") + (> (skip-syntax-forward "w") 0)) + +(defun erc-word-at-arg-p (pos) + "Reports whether the char after a given POS has word syntax. +If POS is out of range, the value is nil." + (let ((c (char-after pos))) + (if c + (eq ?w (char-syntax c)) + nil))) + +(defun erc-bounds-of-word-at-point () + "Returns the bounds of a word at point, or nil if we're not at +a word. If no subword-mode is active, then this +is (bounds-of-thing-at-point 'word)." + (if (or (erc-word-at-arg-p (point)) + (erc-word-at-arg-p (1- (point)))) + (save-excursion + (let* ((start (progn (skip-syntax-backward "w") (point))) + (end (progn (skip-syntax-forward "w") (point)))) + (cons start end))) + nil)) + ;; Used by CTCP functions (defun erc-upcase-first-word (str) "Upcase the first word in STR." (with-temp-buffer (insert str) (goto-char (point-min)) - (upcase-word 1) + (upcase-region (point) (progn (erc-forward-word) (point))) (buffer-string))) (defun erc-server-setup-periodical-ping (buffer) diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index e1ccea90dd1..7d509196330 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -300,14 +300,14 @@ specified by `erc-button-alist'." (when (or (eq t form) (eval form)) (goto-char (point-min)) - (while (forward-word 1) - (setq bounds (bounds-of-thing-at-point 'word)) - (setq word (buffer-substring-no-properties - (car bounds) (cdr bounds))) - (when (or (and (erc-server-buffer-p) (erc-get-server-user word)) - (and erc-channel-users (erc-get-channel-user word))) - (erc-button-add-button (car bounds) (cdr bounds) - fun t (list word))))))) + (while (erc-forward-word) + (when (setq bounds (erc-bounds-of-word-at-point)) + (setq word (buffer-substring-no-properties + (car bounds) (cdr bounds))) + (when (or (and (erc-server-buffer-p) (erc-get-server-user word)) + (and erc-channel-users (erc-get-channel-user word))) + (erc-button-add-button (car bounds) (cdr bounds) + fun t (list word)))))))) (defun erc-button-add-buttons-1 (regexp entry) "Search through the buffer for matches to ENTRY and add buttons." diff --git a/lisp/erc/erc-pcomplete.el b/lisp/erc/erc-pcomplete.el index cf3f51ba3f6..9f572396de8 100644 --- a/lisp/erc/erc-pcomplete.el +++ b/lisp/erc/erc-pcomplete.el @@ -238,10 +238,12 @@ If optional argument IGNORE-SELF is non-nil, don't return the current nick." "Returns a list of all nicks on the current server." (let (nicks) (erc-with-server-buffer - (maphash (lambda (nick _user) - (setq nicks (cons (concat nick postfix) nicks))) + (maphash (lambda (_nick user) + (setq nicks (cons + (concat (erc-server-user-nickname user) postfix) + nicks))) erc-server-users)) - nicks)) + nicks)) (defun pcomplete-erc-channels () "Returns a list of channels associated with the current server." diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index 1750cb77845..4d8feb52759 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -971,7 +971,8 @@ is in `erc-mode'." "Return a list of all faces used in STR." (let ((i 0) (m (length str)) - (faces (erc-list (get-text-property 0 'face str))) + (faces (let ((face1 (get-text-property 0 'face str))) + (when face1 (list face1)))) cur) (while (and (setq i (next-single-property-change i 'face str m)) (not (= i m))) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index b7f40a878a9..98ea594e164 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1141,7 +1141,7 @@ which the local user typed." (define-key map "\C-c\C-u" 'erc-kill-input) (define-key map "\C-c\C-x" 'erc-quit-server) (define-key map "\M-\t" 'ispell-complete-word) - (define-key map "\t" 'completion-at-point) + (define-key map "\t" 'erc-completion-at-point) ;; Suppress `font-lock-fontify-block' key binding since it ;; destroys face properties. @@ -3996,6 +3996,13 @@ Prompt for one if called interactively." (format "MODE %s +k %s" tgt key) (format "MODE %s -k" tgt))))) +(defun erc-completion-at-point () + "Perform complection on the text around point case-insentitively. +See `completion-at-point'." + (interactive) + (let ((completion-ignore-case t)) + (completion-at-point))) + (defun erc-quit-server (reason) "Disconnect from current server after prompting for REASON. `erc-quit-reason' works with this just like with `erc-cmd-QUIT'." @@ -6088,13 +6095,15 @@ If it doesn't exist, create it." (or (file-accessible-directory-p dir) (error "Cannot access %s" dir))) (defun erc-kill-query-buffers (process) - "Kill all buffers of PROCESS." + "Kill all buffers of PROCESS. +Does nothing if PROCESS is not a process object." ;; here, we only want to match the channel buffers, to avoid ;; "selecting killed buffers" b0rkage. - (erc-with-all-buffers-of-server process - (lambda () - (not (erc-server-buffer-p))) - (kill-buffer (current-buffer)))) + (when (processp process) + (erc-with-all-buffers-of-server process + (lambda () + (not (erc-server-buffer-p))) + (kill-buffer (current-buffer))))) (defun erc-nick-at-point () "Give information about the nickname at `point'. |