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

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

Re: Help on indentation


From: manish honap
Subject: Re: Help on indentation
Date: Sat, 31 Mar 2012 23:50:16 +0800 (SGT)

Well when we use `insert-parentheses' it inserts parentheses immediately without any space character like this -

`if()'; but the following binding inserts as `if ()'

Thanks,
Manish


From: "Ludwig, Mark" <ludwig.mark@siemens.com>
To: manish honap <manish_honap_vit@yahoo.co.in>; Nash Steve <nash11228@gmail.com>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Sent: Friday, 30 March 2012 6:05 PM
Subject: RE: Help on indentation

It’s not at all clear why you needed to do this, since M-( is normally bound to insert-parentheses.  (AFAIK, it has been this way for decades.)
 
Regarding making the ‘(‘ character do this, by convention, it would be an “electric” function, and it’s probably not very hard to write.  You might even be happy just binding ‘(‘ to insert-parentheses.
 
Hope this helps,
Mark
 
From: help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org [mailto:help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org] On Behalf Of manish honap
Sent: Friday, March 30, 2012 1:00 AM
To: Nash Steve
Cc: help-gnu-emacs@gnu.org
Subject: Re: Help on indentation
 
Thanks for your help.
 
I got a hint from `http://www.emacswiki.org/emacs/LineCopyChar'
and I added,
 
(defun insert-paren-pair (&optional b)                                                                                                                     
  (interactive "p")                                                                                                                                        
  (let (p col s)                                                                                                                                           
    (setq p (point))                                                                                                                                       
    (setq col (current-column))                                                                                                                            
    (move-to-column col)                                                                                                                                   
    (goto-char p)                                                                                                                                          
    (insert " ()")                                                                                                                                         
    (goto-char (- (point) 1))))                                                                                                                            
                                                                                                                                                           
(define-key global-map (kbd "M-(") 'insert-paren-pair) 
 
to my .emacs
 
this won't solve the original problem, but for specific keywords it will suffice.
 

From: Nash Steve <nash11228@gmail.com>
To: manish honap <manish_honap_vit@yahoo.co.in>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Sent: Friday, 30 March 2012 12:29 AM
Subject: Re: Help on indentation
 
insert-parentheses may help.
 
On Thu, Mar 29, 2012 at 6:58 AM, manish honap <manish_honap_vit@yahoo.co.in> wrote:
I have following query,
 
In cc-mode
whenever I type `(', I want emacs to automatically insert space before it,
just for symbols [if | while | for | switch] during typing;
 
How it can be done ?
 
Thanks,
Manish
 
 



reply via email to

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