[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [solved] Re: To switch state of line not working
From: |
Emanuel Berg |
Subject: |
Re: [solved] Re: To switch state of line not working |
Date: |
Tue, 15 Jun 2021 03:45:54 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
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'
--
underground experts united
https://dataswamp.org/~incal
- To switch state of line not working, Jean Louis, 2021/06/14
- Re: To switch state of line not working, Emanuel Berg, 2021/06/14
- [solved] Re: To switch state of line not working, Jean Louis, 2021/06/14
- Re: [solved] Re: To switch state of line not working,
Emanuel Berg <=
- Re: [solved] Re: To switch state of line not working, Jean Louis, 2021/06/14
- Re: [solved] Re: To switch state of line not working, Jean Louis, 2021/06/14
- Re: [solved] Re: To switch state of line not working, Jean Louis, 2021/06/14
- Re: [solved] Re: To switch state of line not working, Jean Louis, 2021/06/14
- Re: [solved] Re: To switch state of line not working, Emanuel Berg, 2021/06/14
- Re: [solved] Re: To switch state of line not working, Jean Louis, 2021/06/14
- Re: [solved] Re: To switch state of line not working, Emanuel Berg, 2021/06/14
- Re: [solved] Re: To switch state of line not working, Jean Louis, 2021/06/14
- Re: [solved] Re: To switch state of line not working, Emanuel Berg, 2021/06/14
- Re: [solved] Re: To switch state of line not working, Jean Louis, 2021/06/14