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

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

Re: [solved] Re: To switch state of line not working


From: Jean Louis
Subject: Re: [solved] Re: To switch state of line not working
Date: Tue, 15 Jun 2021 04:48:21 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* Emanuel Berg via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> [2021-06-15 04:47]:
> Jean Louis wrote:
> 
> > Now it works... (づ。◕‿‿◕。)づ
> >
> > (defun rcd-check ()
> >   (interactive)
> >   (let* ((start (line-beginning-position))
> >      (end (line-end-position))
> >      (line (buffer-substring start end))
> >      (check-in "[ ]")
> >      (check-out "[✔]")
> >      (check-in (list (regexp-quote check-in) check-in))
> >      (check-in-there (string-match (car check-in) line))
> >      (check-out (list (regexp-quote check-out) check-out))
> >      (check-out-there (string-match (cadr check-out) line)))
> >     (cond ((not (null check-in-there)) (replace-regexp (car check-in) (cadr 
> > check-out) nil start end))
> >       ((not (null check-out-there)) (replace-regexp (car check-out) (cadr 
> > check-in) nil start end))
> >       (t (message-box "Oh no! Could not replace without check box!" 
> > check-out)))))
> >
> >  [ ] something
> 
> Uhm, not null something?
> 
> (not (null t))   ; t
> (not (null nil)) ; nil
> 
> And
> 
> `replace-regexp' -> `re-search-forward', `replace-match'

It's solved...


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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