Indentation (was: [PATCH] Fix memory leaks)

2001-04-04 Thread Henner Zeller



Hi,
two short remarks; I usually put these lines in every file I write

/* Emacs:
 * Local variables:
 * c-basic-offset: 8
 * End:
 * vi:set tabstop=8 shiftwidth=8 nowrap:
 */

which is understood by emacs and vim so these editors are switched to the
'correct' indentation style automatically (without 20 Mails/Thread
necessary :-)

Another: use 'diff -uw' to see see changes which are not due to
whitespaces.

ciao,
 Henner (who goes back to work on his thesis now, but every once in a
 while monitores this list; And just remembers the habit on this
 list a few years ago to close every signature with a little
 statement like this one ..)





Re: Indentation (was: [PATCH] Fix memory leaks)

2001-04-04 Thread Lars Gullik Bjønnes

Henner Zeller [EMAIL PROTECTED] writes:

| Hi,
| two short remarks; I usually put these lines in every file I write
| 
| /* Emacs:
|  * Local variables:
|  * c-basic-offset: 8
|  * End:
|  * vi:set tabstop=8 shiftwidth=8 nowrap:
|  */

the problem is that is not enough... I have:

in my .emacs file:

 ;;; Common hook
(defun my-c-mode-common-hook ()
  ;; Set return Style
  (local-set-key [return] 'newline-and-indent)
  (local-set-key [S-return] 'newline)
  (c-set-style "CC-MODE")
  (setq compile-command "make -k")
  )
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

;; C++ mode hook
(defun my-c++-mode-hook ()
  ;; Style parameters
  (setq c-basic-offset 8)
  (c-set-offset 'innamespace 0)
  (imenu-add-to-menubar "Index")
  (c-toggle-auto-state 0)
)  
(add-hook 'c++-mode-hook 'my-c++-mode-hook)


(custom-set-variables
 '(c-default-style "linux")
 '(c-cleanup-list (quote (brace-else-brace brace-elseif-brace
 empty-defun-braces list-close-comma scope-operator)))
 '(c-hanging-braces-alist (quote ((defun-open before after)
 (defun-close before after) (class-open after) (class-close before)
 (inline-open after) (inline-close before after) (block-open after)
 (block-close before after) (substatement-open after)
 (statement-case-open) (extern-lang-open) (extern-lang-close)
 (brace-list-open) (brace-list-close) (brace-list-intro)
 (brace-entry-open) (inexpr-class-open) (inexpr-class-close
 '(c++-mode-hook (quote (my-c++-mode-hook)) t)
 '(c-comment-continuation-stars " ")
 '(c-indent-comments-syntactically-p t)
 '(c-tab-always-indent t)
 '(c-echo-syntactic-information-p t)
 '(c-strict-syntax-p t)
 '(c-style-variables-are-local-p t)
 '(c-hanging-colons-alist (quote ((case-label) (label after)
 (access-label after) (member-init-intro before) (inher-intro
)


and since this is my setup it is also defining the coding style we use
in LyX. (more or less)

c-basic-offset is only part of it.

-- 
Lgb



RE: Indentation (was: [PATCH] Fix memory leaks)

2001-04-04 Thread Juergen Vigna


On 04-Apr-2001 Henner Zeller wrote:

 /* Emacs:
  * Local variables:
  * c-basic-offset: 8
  * End:
  * vi:set tabstop=8 shiftwidth=8 nowrap:
  */

Where at the very beginning or at the end? (I've read you have to
put this in the first line of the file is that true?)

Ciao,

 Jrgen

--
-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._
Dr. Jrgen VignaE-Mail:  [EMAIL PROTECTED]
Italienallee 13/N   Tel/Fax: +39-0471-450260 / +39-0471-450253
I-39100 Bozen   Web: http://www.sad.it/~jug
-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._

Immature artists imitate, mature artists steal.
-- Lionel Trilling




Re: Indentation (was: [PATCH] Fix memory leaks)

2001-04-04 Thread Stephan Witt

Henner Zeller wrote:
 
 Hi,
 two short remarks; I usually put these lines in every file I write
 
 /* Emacs:
  * Local variables:
  * c-basic-offset: 8
  * End:
  * vi:set tabstop=8 shiftwidth=8 nowrap:
  */
 
 which is understood by emacs and vim so these editors are switched to the
 'correct' indentation style automatically (without 20 Mails/Thread
 necessary :-)
 
 Another: use 'diff -uw' to see see changes which are not due to
 whitespaces.

One short remark. The line with * vi:... doesn't work with
all vi-clones, I'm using the nvi and read in the documentation:

 modelines, modeline [off]
  If the modelines option is set, ex/vi has histori-
  cally  scanned  the  first  and last five lines of
  each file as it is read for editing,  looking  for
  any  ex  commands  that  have been placed in those
  lines.  After the  startup  information  has  been
  processed,  and before the user starts editing the
  file, any commands embedded in the file  are  exe-
  cuted.

  Commands were recognized by the letters "e" or "v"
  followed by "x" or "i", at the beginning of a line
  or  following  a  tab or space character, and fol-
  lowed by a ":", an ex command, and another ":".

  This option is a security problem of immense  pro-
  portions, and should not be used under any circum-
  stances.

  This option will never be implemented.



Greetings from the security paranoid Stephan


[EMAIL PROTECTED] | beusen Solutions GmbH
fon: +49 30 549932-62| Landsberger Allee 366
fax: +49 30 549932-21| 12681 Berlin, Germany





Re: Indentation (was: [PATCH] Fix memory leaks)

2001-04-04 Thread Henner Zeller


HI,
LGBn| [ Emacs - .. Lots Of Irritating Single Parenthesis [LISP]]
LGBn| and since this is my setup it is also defining the coding style we use
LGBn| in LyX. (more or less)
LGBn| 
LGBn| c-basic-offset is only part of it.

.. but the most annoying if there are mixed indentation styles. I
personally don't mind if people have if (..) { or if (..)\n{ as
long as the indentation matches the rest of the file.
There could be another possibility:
provide a lyxsty.el and invoke it with a similar comment in emacs
(I think this is possible .. and if so there could be a real Macro-Virus
problem :-)

ciao,
 -hen




RE: Indentation (was: [PATCH] Fix memory leaks)

2001-04-04 Thread Henner Zeller


Hi,
On Wed, 4 Apr 2001, Juergen Vigna wrote:
JV|  /* Emacs:
JV|   * Local variables:
JV|   * c-basic-offset: 8
JV|   * End:
JV|   * vi:set tabstop=8 shiftwidth=8 nowrap:
JV|   */
JV| 
JV| Where at the very beginning or at the end? (I've read you have to
JV| put this in the first line of the file is that true?)

works at the end. Only if you have something like '-*- C++ -*-' this must
be in the first two lines.

ciao,
 -hen




Indentation (was: [PATCH] Fix memory leaks)

2001-04-04 Thread Henner Zeller



Hi,
two short remarks; I usually put these lines in every file I write

/* Emacs:
 * Local variables:
 * c-basic-offset: 8
 * End:
 * vi:set tabstop=8 shiftwidth=8 nowrap:
 */

which is understood by emacs and vim so these editors are switched to the
'correct' indentation style automatically (without 20 Mails/Thread
necessary :-)

Another: use 'diff -uw' to see see changes which are not due to
whitespaces.

ciao,
 Henner (who goes back to work on his thesis now, but every once in a
 while monitores this list; And just remembers the habit on this
 list a few years ago to close every signature with a little
 statement like this one ..)





Re: Indentation (was: [PATCH] Fix memory leaks)

2001-04-04 Thread Lars Gullik Bjønnes

Henner Zeller <[EMAIL PROTECTED]> writes:

| Hi,
| two short remarks; I usually put these lines in every file I write
| 
| /* Emacs:
|  * Local variables:
|  * c-basic-offset: 8
|  * End:
|  * vi:set tabstop=8 shiftwidth=8 nowrap:
|  */

the problem is that is not enough... I have:

in my .emacs file:

 ;;; Common hook
(defun my-c-mode-common-hook ()
  ;; Set return Style
  (local-set-key [return] 'newline-and-indent)
  (local-set-key [S-return] 'newline)
  (c-set-style "CC-MODE")
  (setq compile-command "make -k")
  )
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

;; C++ mode hook
(defun my-c++-mode-hook ()
  ;; Style parameters
  (setq c-basic-offset 8)
  (c-set-offset 'innamespace 0)
  (imenu-add-to-menubar "Index")
  (c-toggle-auto-state 0)
)  
(add-hook 'c++-mode-hook 'my-c++-mode-hook)


(custom-set-variables
 '(c-default-style "linux")
 '(c-cleanup-list (quote (brace-else-brace brace-elseif-brace
 empty-defun-braces list-close-comma scope-operator)))
 '(c-hanging-braces-alist (quote ((defun-open before after)
 (defun-close before after) (class-open after) (class-close before)
 (inline-open after) (inline-close before after) (block-open after)
 (block-close before after) (substatement-open after)
 (statement-case-open) (extern-lang-open) (extern-lang-close)
 (brace-list-open) (brace-list-close) (brace-list-intro)
 (brace-entry-open) (inexpr-class-open) (inexpr-class-close
 '(c++-mode-hook (quote (my-c++-mode-hook)) t)
 '(c-comment-continuation-stars " ")
 '(c-indent-comments-syntactically-p t)
 '(c-tab-always-indent t)
 '(c-echo-syntactic-information-p t)
 '(c-strict-syntax-p t)
 '(c-style-variables-are-local-p t)
 '(c-hanging-colons-alist (quote ((case-label) (label after)
 (access-label after) (member-init-intro before) (inher-intro
)


and since this is my setup it is also defining the coding style we use
in LyX. (more or less)

c-basic-offset is only part of it.

-- 
Lgb



RE: Indentation (was: [PATCH] Fix memory leaks)

2001-04-04 Thread Juergen Vigna


On 04-Apr-2001 Henner Zeller wrote:

> /* Emacs:
>  * Local variables:
>  * c-basic-offset: 8
>  * End:
>  * vi:set tabstop=8 shiftwidth=8 nowrap:
>  */

Where at the very beginning or at the end? (I've read you have to
put this in the first line of the file is that true?)

Ciao,

 Jürgen

--
-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._
Dr. Jürgen VignaE-Mail:  [EMAIL PROTECTED]
Italienallee 13/N   Tel/Fax: +39-0471-450260 / +39-0471-450253
I-39100 Bozen   Web: http://www.sad.it/~jug
-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._

Immature artists imitate, mature artists steal.
-- Lionel Trilling




Re: Indentation (was: [PATCH] Fix memory leaks)

2001-04-04 Thread Stephan Witt

Henner Zeller wrote:
> 
> Hi,
> two short remarks; I usually put these lines in every file I write
> 
> /* Emacs:
>  * Local variables:
>  * c-basic-offset: 8
>  * End:
>  * vi:set tabstop=8 shiftwidth=8 nowrap:
>  */
> 
> which is understood by emacs and vim so these editors are switched to the
> 'correct' indentation style automatically (without 20 Mails/Thread
> necessary :-)
> 
> Another: use 'diff -uw' to see see changes which are not due to
> whitespaces.

One short remark. The line with * vi:... doesn't work with
all vi-clones, I'm using the nvi and read in the documentation:

 modelines, modeline [off]
  If the modelines option is set, ex/vi has histori-
  cally  scanned  the  first  and last five lines of
  each file as it is read for editing,  looking  for
  any  ex  commands  that  have been placed in those
  lines.  After the  startup  information  has  been
  processed,  and before the user starts editing the
  file, any commands embedded in the file  are  exe-
  cuted.

  Commands were recognized by the letters "e" or "v"
  followed by "x" or "i", at the beginning of a line
  or  following  a  tab or space character, and fol-
  lowed by a ":", an ex command, and another ":".

  This option is a security problem of immense  pro-
  portions, and should not be used under any circum-
  stances.

  This option will never be implemented.



Greetings from the security paranoid Stephan


<[EMAIL PROTECTED]> | beusen Solutions GmbH
fon: +49 30 549932-62| Landsberger Allee 366
fax: +49 30 549932-21| 12681 Berlin, Germany





Re: Indentation (was: [PATCH] Fix memory leaks)

2001-04-04 Thread Henner Zeller


HI,
LGBn| [ Emacs - .. Lots Of Irritating Single Parenthesis [LISP]]
LGBn| and since this is my setup it is also defining the coding style we use
LGBn| in LyX. (more or less)
LGBn| 
LGBn| c-basic-offset is only part of it.

.. but the most annoying if there are mixed indentation styles. I
personally don't mind if people have "if (..) {" or if (..)\n{" as
long as the indentation matches the rest of the file.
There could be another possibility:
provide a lyxsty.el and invoke it with a similar comment in emacs
(I think this is possible .. and if so there could be a real Macro-Virus
problem :-)

ciao,
 -hen




RE: Indentation (was: [PATCH] Fix memory leaks)

2001-04-04 Thread Henner Zeller


Hi,
On Wed, 4 Apr 2001, Juergen Vigna wrote:
JV| > /* Emacs:
JV| >  * Local variables:
JV| >  * c-basic-offset: 8
JV| >  * End:
JV| >  * vi:set tabstop=8 shiftwidth=8 nowrap:
JV| >  */
JV| 
JV| Where at the very beginning or at the end? (I've read you have to
JV| put this in the first line of the file is that true?)

works at the end. Only if you have something like '-*- C++ -*-' this must
be in the first two lines.

ciao,
 -hen