Properly set text conversion style within ERC buffers
* lisp/erc/erc.el (erc-mode): Register `erc-check-text-conversion' as a local post command hook. (set-text-conversion-style): New function. Detect if point is within the input prompt, then enable or disable text conversion correspondingly.
This commit is contained in:
parent
617ddb8089
commit
8d13ad2318
1 changed files with 17 additions and 0 deletions
|
@ -1538,6 +1538,7 @@ Defaults to the server buffer."
|
|||
(setq-local paragraph-start
|
||||
(concat "\\(" (regexp-quote (erc-prompt)) "\\)"))
|
||||
(setq-local completion-ignore-case t)
|
||||
(add-hook 'post-command-hook #'erc-check-text-conversion nil t)
|
||||
(add-hook 'kill-buffer-hook #'erc-kill-buffer-function nil t)
|
||||
(add-hook 'completion-at-point-functions #'erc-complete-word-at-point nil t))
|
||||
|
||||
|
@ -8030,6 +8031,22 @@ or `erc-kill-buffer-hook' if any other buffer."
|
|||
(t
|
||||
(run-hooks 'erc-kill-buffer-hook)))))
|
||||
|
||||
(declare-function set-text-conversion-style "textconv.c")
|
||||
|
||||
(defun erc-check-text-conversion ()
|
||||
"Check if point is within the ERC prompt and toggle text conversion.
|
||||
If `text-conversion-style' is not `action' if point is within the
|
||||
prompt or `nil' otherwise, set it to such a value, so as to
|
||||
guarantee that the input method functions properly for the
|
||||
purpose of typing within the ERC prompt."
|
||||
(when (and (eq major-mode 'erc-mode)
|
||||
(boundp set-text-conversion-style))
|
||||
(if (>= (point) (erc-beg-of-input-line))
|
||||
(unless (eq text-conversion-style 'action)
|
||||
(set-text-conversion-style 'action))
|
||||
(unless (not text-conversion-style)
|
||||
(set-text-conversion-style nil)))))
|
||||
|
||||
(defun erc-kill-server ()
|
||||
"Sends a QUIT command to the server when the server buffer is killed.
|
||||
This function should be on `erc-kill-server-hook'."
|
||||
|
|
Loading…
Add table
Reference in a new issue