help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Use regex in ~/.emacs.d/init.el to match no_proxy.


From: tomas
Subject: Re: Use regex in ~/.emacs.d/init.el to match no_proxy.
Date: Wed, 7 Apr 2021 09:19:39 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Apr 07, 2021 at 09:26:42AM +0800, Hongyi Zhao wrote:

[...]

> Additional Comment: I also tried to use the eshell method to call this
> function, but failed as shown below:
> 
> M-x eshell RET
> 
> ~ $ regexp-opt ("*.cn" "localhost" "10.0.0.0/8" "127.0.0.0/8"
> "172.16.0.0/12" "192.168.0.0/16")

I don't know about your other points, but can give a hint on this
one. The `eshell' takes expressions in Lisp syntax, that means
you have to write `(function arg1 arg2 ...)' instead of the more
customary `function (arg1 arg2 ...)'. In your case:

[1]  (regexp-opt "*.cn" "localhost" "10.0.0.0/8" "127.0.0.0/8" "172.16.0.0/12" 
"192.168.0.0/16")

will lead to the desired result. That's why:
  
> Wrong type argument: list-or-vector-p, "Invalid function: \"*.cn\""

eshell complains here: it is trying to apply a function `".cn"' to the
rest of the arguments. But there is no function with such a funny
name (quotes and all).

Eshell allows you to leave out the outermost parentheses, so instead
of [1] you can also write

[2]  regexp-opt "*.cn" "localhost" "10.0.0.0/8" "127.0.0.0/8" "172.16.0.0/12" 
"192.168.0.0/16"

as a convenience.

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

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