[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strip signature on reply without standard separator
From: |
Emanuel Berg |
Subject: |
Re: Strip signature on reply without standard separator |
Date: |
Wed, 21 Sep 2022 15:15:50 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Satoshi Yoshida wrote:
>> In your case, you could do
>>
>> (defun strip-signature (re &optional rep)
>> (or rep (setq rep ""))
>> ;; ...
>
> It's amazing. But I want to avoid grobal variable.
> Please show me the way to use let instead of setq.
> I don't know how to use it in this case.
'rep' is a formal parameter of the function, under
lexical/static scope - which you should always use BTW, put
;;; -*- lexical-binding: t -*-
topmost in your file (every Elisp file) if you didn't - that
means you get a local variable that again is lexical/static
and, equivalently, not dynamic/special.
Just try - and you will fly ...
;;; -*- lexical-binding: t -*-
(defun c ()
(message b) )
(defun a (b)
(message b)
(setq b "ah")
(c) )
;; (a "oh")
;; ^ eval me
Also, byte-compiling this will echo a warning saying b is
a free variable, and this even under dynamic/special scope
where the code actually works tho (i.e. this particular use of
'a' and 'c' where 'a' is used first).
>> Okay, I dare say most people would write that
>>
>> (dolist (e '((1 2) (3 4)))
>> (message "%s %s" (car e) (cadr e)) )
>>
>> Or maybe
>>
>> (require 'cl-lib)
>> (cl-loop for (a b) in '((x y) (i j)) do
>> (message "%s %s" a b) )
>
> Thank you. I want to use dolist.
As you see you don't need `apply' even with `dolist', no need.
--
underground experts united
https://dataswamp.org/~incal
- Re: Strip signature on reply without standard separator, Satoshi Yoshida, 2022/09/03
- Re: Strip signature on reply without standard separator, Emanuel Berg, 2022/09/03
- Re: Strip signature on reply without standard separator, Satoshi Yoshida, 2022/09/06
- Re: Strip signature on reply without standard separator, Emanuel Berg, 2022/09/06
- Re: Strip signature on reply without standard separator, Satoshi Yoshida, 2022/09/15
- Re: Strip signature on reply without standard separator, Emanuel Berg, 2022/09/18
- Re: Strip signature on reply without standard separator, Satoshi Yoshida, 2022/09/21
- Re: Strip signature on reply without standard separator,
Emanuel Berg <=
- Re: Strip signature on reply without standard separator, Satoshi Yoshida, 2022/09/23
- Re: Strip signature on reply without standard separator, Emanuel Berg, 2022/09/24
- Re: Strip signature on reply without standard separator, Satoshi Yoshida, 2022/09/24
- Re: Strip signature on reply without standard separator, Emanuel Berg, 2022/09/24
- Re: Strip signature on reply without standard separator, Satoshi Yoshida, 2022/09/26
- Re: Strip signature on reply without standard separator, Emanuel Berg, 2022/09/26
- Re: Strip signature on reply without standard separator, Michael Heerdegen, 2022/09/25
- Re: Strip signature on reply without standard separator, Satoshi Yoshida, 2022/09/26