unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* matching parentheses
@ 2007-08-20  7:46 Alain Muls
  0 siblings, 0 replies; 12+ messages in thread
From: Alain Muls @ 2007-08-20  7:46 UTC (permalink / raw)
  To: emacs list

Hi

How does one insert automatically matching parentheses in emacs when in 
auctex mode?

Tx/Alain

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: matching parentheses
       [not found] <mailman.4991.1187599974.32220.help-gnu-emacs@gnu.org>
@ 2007-08-20 14:01 ` Maarten Bergvelt
  2007-08-20 16:50 ` Ralf Angeli
  1 sibling, 0 replies; 12+ messages in thread
From: Maarten Bergvelt @ 2007-08-20 14:01 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.4991.1187599974.32220.help-gnu-emacs@gnu.org>, Alain Muls wrote:
> How does one insert automatically matching parentheses in emacs when in 
> auctex mode?
Hm, for braces you use Tex-insert-braces, bound to C-c-{. I don't
think there is a predefined parentheses analog. You can of course
modify Tex-insert-braces. by replacing tex-grop and texgrcl by ( and
). The key binding C-c-( is already taken, though.

-- 
Maarten Bergvelt		

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: matching parentheses
       [not found] <mailman.4991.1187599974.32220.help-gnu-emacs@gnu.org>
  2007-08-20 14:01 ` matching parentheses Maarten Bergvelt
@ 2007-08-20 16:50 ` Ralf Angeli
  2007-08-20 16:56   ` Joel J. Adamson
  1 sibling, 1 reply; 12+ messages in thread
From: Ralf Angeli @ 2007-08-20 16:50 UTC (permalink / raw)
  To: help-gnu-emacs

* Alain Muls (2007-08-20) writes:

> How does one insert automatically matching parentheses in emacs when in 
> auctex mode?

(info "(autotype)Inserting Pairs")

-- 
Ralf

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: matching parentheses
  2007-08-20 16:50 ` Ralf Angeli
@ 2007-08-20 16:56   ` Joel J. Adamson
  2007-08-20 18:04     ` Maarten Bergvelt
  0 siblings, 1 reply; 12+ messages in thread
From: Joel J. Adamson @ 2007-08-20 16:56 UTC (permalink / raw)
  To: help-gnu-emacs

Ralf Angeli <dev.null@caeruleus.net> writes:

> * Alain Muls (2007-08-20) writes:
>
>> How does one insert automatically matching parentheses in emacs when in 
>> auctex mode?
>
> (info "(autotype)Inserting Pairs")

How automatic do you want it?  I press "M-(" and I get () with the
point inside the parentheses.  Here, I'll do it again: ()

That's pretty cool ;)

Joel

-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: matching parentheses
  2007-08-20 16:56   ` Joel J. Adamson
@ 2007-08-20 18:04     ` Maarten Bergvelt
  2007-08-21  8:15       ` Tim X
  0 siblings, 1 reply; 12+ messages in thread
From: Maarten Bergvelt @ 2007-08-20 18:04 UTC (permalink / raw)
  To: help-gnu-emacs

On 2007-08-20, Joel J. Adamson <jadamson@partners.org> wrote:
> Ralf Angeli <dev.null@caeruleus.net> writes:
>
>> * Alain Muls (2007-08-20) writes:
>>
>>> How does one insert automatically matching parentheses in emacs when in 
>>> auctex mode?
>>
>> (info "(autotype)Inserting Pairs")
>
> How automatic do you want it?  I press "M-(" and I get () with the
> point inside the parentheses.  Here, I'll do it again: ()

Interesting. I knew about C-c-{ in Auctex but not about M-( in
general. Why the different mechanisms in very similar cases?

-- 
Maarten Bergvelt		

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: matching parentheses
  2007-08-20 18:04     ` Maarten Bergvelt
@ 2007-08-21  8:15       ` Tim X
  0 siblings, 0 replies; 12+ messages in thread
From: Tim X @ 2007-08-21  8:15 UTC (permalink / raw)
  To: help-gnu-emacs

Maarten Bergvelt <bergv@math.uiuc.edu> writes:

> On 2007-08-20, Joel J. Adamson <jadamson@partners.org> wrote:
>> Ralf Angeli <dev.null@caeruleus.net> writes:
>>
>>> * Alain Muls (2007-08-20) writes:
>>>
>>>> How does one insert automatically matching parentheses in emacs when in 
>>>> auctex mode?
>>>
>>> (info "(autotype)Inserting Pairs")
>>
>> How automatic do you want it?  I press "M-(" and I get () with the
>> point inside the parentheses.  Here, I'll do it again: ()
>
> Interesting. I knew about C-c-{ in Auctex but not about M-( in
> general. Why the different mechanisms in very similar cases?

Given that emacs uses a lisp dialect as an extension language and the ()
are so central to lisp syntax, I suspect that making M-( general was
considered a good idea. Only a guess though.

Tim

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Matching Parentheses
@ 2020-10-03 10:39 Christopher Dimech
  2020-10-03 10:53 ` Christopher Dimech
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Christopher Dimech @ 2020-10-03 10:39 UTC (permalink / raw)
  To: Help Gnu Emacs


I am trying to match parenthesis, however the highlighting is difficult to
see. Any idea on how to make the matching look very pronounced.

I have been using the following code

(show-paren-mode 1)
(setq show-paren-delay 0)

(require 'paren)
(set-face-background 'show-paren-match (face-background 'default))
(set-face-foreground 'show-paren-match "#def")
(set-face-attribute 'show-paren-match nil :weight 'extra-bold)





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Matching Parentheses
  2020-10-03 10:39 Matching Parentheses Christopher Dimech
@ 2020-10-03 10:53 ` Christopher Dimech
  2020-10-03 11:25   ` Gregory Heytings via Users list for the GNU Emacs text editor
  2020-10-03 11:29 ` Eli Zaretskii
  2020-10-03 18:39 ` Drew Adams
  2 siblings, 1 reply; 12+ messages in thread
From: Christopher Dimech @ 2020-10-03 10:53 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Help Gnu Emacs


I also tried to highlight the entire expression using

(setq show-paren-style 'expression)

However the foreground colour is not very pronounced.
How can I change the foreground and background colours
for matching parentheses?


> Sent: Saturday, October 03, 2020 at 11:39 AM
> From: "Christopher Dimech" <dimech@gmx.com>
> To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Matching Parentheses
>
>
> I am trying to match parenthesis, however the highlighting is difficult to
> see. Any idea on how to make the matching look very pronounced.
>
> I have been using the following code
>
> (show-paren-mode 1)
> (setq show-paren-delay 0)
>
> (require 'paren)
> (set-face-background 'show-paren-match (face-background 'default))
> (set-face-foreground 'show-paren-match "#def")
> (set-face-attribute 'show-paren-match nil :weight 'extra-bold)
>
>
>
>



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Matching Parentheses
  2020-10-03 10:53 ` Christopher Dimech
@ 2020-10-03 11:25   ` Gregory Heytings via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 12+ messages in thread
From: Gregory Heytings via Users list for the GNU Emacs text editor @ 2020-10-03 11:25 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Help Gnu Emacs


>
> I am trying to match parenthesis, however the highlighting is difficult 
> to see. Any idea on how to make the matching look very pronounced.
>

show-paren-mode without additional configuration should be clearly 
visible, with or without (setq show-paren-style 'expression).

Of course, if you do:

(set-face-background 'show-paren-match (face-background 'default))

you will not see anything anymore.  I would suggest:

(set-face-background 'show-paren-match "green")
(set-face-background 'show-paren-mismatch "red")



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Matching Parentheses
  2020-10-03 10:39 Matching Parentheses Christopher Dimech
  2020-10-03 10:53 ` Christopher Dimech
@ 2020-10-03 11:29 ` Eli Zaretskii
  2020-10-03 13:11   ` Christopher Dimech
  2020-10-03 18:39 ` Drew Adams
  2 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2020-10-03 11:29 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Christopher Dimech <dimech@gmx.com>
> Date: Sat, 3 Oct 2020 12:39:33 +0200
> 
> (set-face-background 'show-paren-match (face-background 'default))
> (set-face-foreground 'show-paren-match "#def")
> (set-face-attribute 'show-paren-match nil :weight 'extra-bold)

This is wrong: show-paren-mode shows the parentheses with a different
background color, and you here set the background to the default one,
thus effectively disabling the feature.

Find a background color that makes the parentheses look prominently,
and change only the background of the show-paren-match face.  Leave
all the other attributes of the show-paren-match face unspecified.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Matching Parentheses
  2020-10-03 11:29 ` Eli Zaretskii
@ 2020-10-03 13:11   ` Christopher Dimech
  0 siblings, 0 replies; 12+ messages in thread
From: Christopher Dimech @ 2020-10-03 13:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

I have done it as follows. Is it good to first call
(require 'paren). I want to either highlight either
the parentheses only or the entire expression using
a keybinding, but unsure how to go about using setq.

For normal keybindings I use
(global-set-key (kbd "<f1> s") 'shell)


Here is thi code for highlighting parentheses


(require 'paren)

(show-paren-mode 1)
(setq show-paren-delay 0)
(set-face-background 'show-paren-match "#76e8f2")
(set-face-foreground 'show-paren-match "#3c0069")

; Highlight the Entire Expression
(setq show-paren-style 'parenthesis)
;(setq show-paren-style 'expression)




> Sent: Saturday, October 03, 2020 at 12:29 PM
> From: "Eli Zaretskii" <eliz@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Matching Parentheses
>
> > From: Christopher Dimech <dimech@gmx.com>
> > Date: Sat, 3 Oct 2020 12:39:33 +0200
> >
> > (set-face-background 'show-paren-match (face-background 'default))
> > (set-face-foreground 'show-paren-match "#def")
> > (set-face-attribute 'show-paren-match nil :weight 'extra-bold)
>
> This is wrong: show-paren-mode shows the parentheses with a different
> background color, and you here set the background to the default one,
> thus effectively disabling the feature.
>
> Find a background color that makes the parentheses look prominently,
> and change only the background of the show-paren-match face.  Leave
> all the other attributes of the show-paren-match face unspecified.
>
>



^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: Matching Parentheses
  2020-10-03 10:39 Matching Parentheses Christopher Dimech
  2020-10-03 10:53 ` Christopher Dimech
  2020-10-03 11:29 ` Eli Zaretskii
@ 2020-10-03 18:39 ` Drew Adams
  2 siblings, 0 replies; 12+ messages in thread
From: Drew Adams @ 2020-10-03 18:39 UTC (permalink / raw)
  To: Christopher Dimech, Help Gnu Emacs

> I am trying to match parenthesis, however the highlighting is difficult to
> see. Any idea on how to make the matching look very pronounced.
> 
> I have been using the following code
> 
> (show-paren-mode 1)
> (setq show-paren-delay 0)
> 
> (require 'paren)
> (set-face-background 'show-paren-match (face-background 'default))
> (set-face-foreground 'show-paren-match "#def")
> (set-face-attribute 'show-paren-match nil :weight 'extra-bold)

Use `M-x customize-face show-paren-match'.

And you can use the same command on the other
show-paren faces:

 show-paren-match-expression
 show-paren-match-face
 show-paren-mismatch

In the Customize UI you can easily see the
result of your changes, before saving them.



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-10-03 18:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.4991.1187599974.32220.help-gnu-emacs@gnu.org>
2007-08-20 14:01 ` matching parentheses Maarten Bergvelt
2007-08-20 16:50 ` Ralf Angeli
2007-08-20 16:56   ` Joel J. Adamson
2007-08-20 18:04     ` Maarten Bergvelt
2007-08-21  8:15       ` Tim X
2020-10-03 10:39 Matching Parentheses Christopher Dimech
2020-10-03 10:53 ` Christopher Dimech
2020-10-03 11:25   ` Gregory Heytings via Users list for the GNU Emacs text editor
2020-10-03 11:29 ` Eli Zaretskii
2020-10-03 13:11   ` Christopher Dimech
2020-10-03 18:39 ` Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2007-08-20  7:46 matching parentheses Alain Muls

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).