emacs-erc
[Top][All Lists]
Advanced

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

Re: ERC function return the nick


From: Emanuel Berg
Subject: Re: ERC function return the nick
Date: Sun, 06 Feb 2022 17:12:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

GNU Hacker wrote:

> (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) )

(defun erc-get-nick ()
  (save-excursion
    (re-search-backward "<\\(.+\\)>" nil t)
    (match-string-no-properties 1) ))

;; <nick>
;;
;; (erc-get-nick) ; test here

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

Error: see the `re-search-backward' docstring for the NOERROR
formal parameter ...

Bad hits: refine the REGEXP

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

Well, stop killing them then :)

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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