emacs-erc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ERC function return the nick


From: GNU Hacker
Subject: ERC function return the nick
Date: Sat, 05 Feb 2022 13:46:07 +0100

I try write a function that return the nick when someone talk in a chat.

I try with the hook:

erc-insert-pre-hook



#+begin_src elisp

(defun my-erc-return-nick (str)
  "return the nick"
  (save-excursion
    (goto-char (point-max))
    (if (re-search-backward "<.*> ")
        (if (re-search-forward ".*>")
            (kill-ring-save
             (+ (re-search-backward "<.*> ") 1)
             (- (re-search-forward ".*>") 1) ) )) )
  (current-kill 0) )

(add-hook 'erc-insert-pre-hook 'my-erc-return-nick)

#+end_src



But it return an error with irc modes or notices or stuff alike.

Also this function fill my kill-ring with useless nicks.


any idea about? thanks



reply via email to

[Prev in Thread] Current Thread [Next in Thread]