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

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

Re: Toggle between read-only-mode


From: jai-bholeki
Subject: Re: Toggle between read-only-mode
Date: Fri, 06 Nov 2020 12:23:14 +0000

Have done as follows, and it works

(defun parenhl-cycle ()
   "Toggles the highlighting of parenthetical regions."
   (interactive)
   ;; Use the property 'state' to cycle between parenthetical styles
   (if (get 'paren-expr 'state)
      (progn
        (setq show-paren-style 'parenthesis)
        (put 'paren-expr  'state nil))
      (progn
        (setq show-paren-style 'expression)
        (put 'paren-expr  'state t))))

(global-set-key (kbd "H-z") 'parenhl-cycle)





‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, 6 November 2020 11:53, jai-bholeki via Users list for the GNU Emacs 
text editor <help-gnu-emacs@gnu.org> wrote:

> Have made two functions to set paren-style-parenthesis.
>
> Now I am trying to make a keybinding that toggles through the two settings.
> Have checked around and have not found examples on how it can be done.
>
> > (defun parenhl-paren ()
> > "paren-style-parenthesis sets highlighting for parenthetical marks"
> > (interactive)
> > (setq show-paren-style 'parenthesis)
> > )
> > (defun parenhl-expr ()
> > "paren-style-parenthesis sets highlighting for parenthetical marks"
> > (interactive)
> > (setq show-paren-style 'expression)
> > )
>
> Sent withProtonMail Secure Email.





reply via email to

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