unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* ctypes.el is stupid (by default)
@ 2005-12-22  6:17 shreevatsa
  2005-12-28  7:35 ` shreevatsa
  2005-12-28 21:36 ` Kevin Rodgers
  0 siblings, 2 replies; 8+ messages in thread
From: shreevatsa @ 2005-12-22  6:17 UTC (permalink / raw)


I'm on Ubuntu, installed package emacs-extra and it screwed up a lot of
(minor) things. The most major change was the weird colours (blue
cursor?), but I commented out the custom-set-faces stuff in
/usr/share/emacs/site-lisp/emacs-extra/emacs-extra.el. Turning on
auto-fill-mode for C and C++ is certainly NOT what I want, I commented
out that too. The only remaining problem is with ctypes.el

It does not know of any of the C++ types that emacs used to highlight
earlier  -- set, string, map, vector, most of the STL, basically. How
do I get it to learn about them?

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

* Re: ctypes.el is stupid (by default)
  2005-12-22  6:17 ctypes.el is stupid (by default) shreevatsa
@ 2005-12-28  7:35 ` shreevatsa
  2005-12-28 10:03   ` Matthieu Moy
  2005-12-28 21:36 ` Kevin Rodgers
  1 sibling, 1 reply; 8+ messages in thread
From: shreevatsa @ 2005-12-28  7:35 UTC (permalink / raw)


Anyone? How do I teach ctypes.el the STL? Why would anyone use
ctypes.el if it recognises even fewer types than the default?...

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

* Re: ctypes.el is stupid (by default)
  2005-12-28  7:35 ` shreevatsa
@ 2005-12-28 10:03   ` Matthieu Moy
  2005-12-28 17:01     ` shreevatsa
  0 siblings, 1 reply; 8+ messages in thread
From: Matthieu Moy @ 2005-12-28 10:03 UTC (permalink / raw)


"shreevatsa" <shreevatsa.public@gmail.com> writes:

> Anyone? How do I teach ctypes.el the STL? Why would anyone use
> ctypes.el if it recognises even fewer types than the default?...

I don't know ctype.el, but what about `c++-font-lock-extra-types'?

-- 
Matthieu

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

* Re: ctypes.el is stupid (by default)
  2005-12-28 10:03   ` Matthieu Moy
@ 2005-12-28 17:01     ` shreevatsa
  2005-12-28 21:38       ` Kevin Rodgers
       [not found]       ` <mailman.20728.1135806945.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: shreevatsa @ 2005-12-28 17:01 UTC (permalink / raw)


Ok, c++-font-lock-extra-types somewhat fixes the issue -- I added
(setq c++-font-lock-extra-types
      (append
       '(
         "ios" "string" "rope" "list" "slist" "deque" "vector" "set"
         "multiset" "map" "multimap" "hash" "stack" "queue"
"priority_queue"
         "iterator" "const_iterator" "reverse_iterator"
         "const_reverse_iterator" "reference" "const_reference")
       c-font-lock-extra-types
       c++-font-lock-extra-types))
to my .emacs, and everything seems to work AFAIK. Thanks a lot.

But in general: How do I know that this is all there is? Why should I
have to do this, why can't ctypes.el NOT mess up an existing setup?

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

* Re: ctypes.el is stupid (by default)
  2005-12-22  6:17 ctypes.el is stupid (by default) shreevatsa
  2005-12-28  7:35 ` shreevatsa
@ 2005-12-28 21:36 ` Kevin Rodgers
  1 sibling, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2005-12-28 21:36 UTC (permalink / raw)


shreevatsa wrote:
> I'm on Ubuntu, installed package emacs-extra and it screwed up a lot of
> (minor) things. The most major change was the weird colours (blue
> cursor?), but I commented out the custom-set-faces stuff in
> /usr/share/emacs/site-lisp/emacs-extra/emacs-extra.el. Turning on
> auto-fill-mode for C and C++ is certainly NOT what I want, I commented
> out that too. The only remaining problem is with ctypes.el
> 
> It does not know of any of the C++ types that emacs used to highlight
> earlier  -- set, string, map, vector, most of the STL, basically. How
> do I get it to learn about them?

Did you read the commentary at the beginning of ctypes.el?

-- 
Kevin Rodgers

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

* Re: ctypes.el is stupid (by default)
  2005-12-28 17:01     ` shreevatsa
@ 2005-12-28 21:38       ` Kevin Rodgers
       [not found]       ` <mailman.20728.1135806945.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2005-12-28 21:38 UTC (permalink / raw)


shreevatsa wrote:
> Ok, c++-font-lock-extra-types somewhat fixes the issue -- I added
> (setq c++-font-lock-extra-types
>       (append
>        '(
>          "ios" "string" "rope" "list" "slist" "deque" "vector" "set"
>          "multiset" "map" "multimap" "hash" "stack" "queue"
> "priority_queue"
>          "iterator" "const_iterator" "reverse_iterator"
>          "const_reverse_iterator" "reference" "const_reference")
>        c-font-lock-extra-types
>        c++-font-lock-extra-types))
> to my .emacs, and everything seems to work AFAIK. Thanks a lot.
> 
> But in general: How do I know that this is all there is? Why should I
> have to do this, why can't ctypes.el NOT mess up an existing setup?

One problem is that merely loading ctypes affects subsequent editing.
You could try to disable ctypes with:
(remove-hook 'find-file-hooks 'ctypes-find-file-hook)

-- 
Kevin Rodgers

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

* Re: ctypes.el is stupid (by default)
       [not found]       ` <mailman.20728.1135806945.20277.help-gnu-emacs@gnu.org>
@ 2005-12-29 16:07         ` shreevatsa
  2005-12-29 19:34           ` Kevin Rodgers
  0 siblings, 1 reply; 8+ messages in thread
From: shreevatsa @ 2005-12-29 16:07 UTC (permalink / raw)


Kevin Rodgers wrote:
>
> One problem is that merely loading ctypes affects subsequent editing.
> You could try to disable ctypes with:
> (remove-hook 'find-file-hooks 'ctypes-find-file-hook)
>
But I _want_ ctypes.el! It's nice and helpful, although it has a few
bugs:
1. STL types not recognized
2. In c++-mode, it recognizes a class as a new type, but not a struct
(probably because of the way it works in C). Unfortunately, I hardly
know any Emacs-lisp, so I can't fix this myself.
3. The link given in ctypes.el, namely
http://www.csd.uu.se/~andersl/emacs.shtml does not work. There's even
an unanswered post about it at
http://list-archive.xemacs.org/xemacs-beta/200311/msg00064.html

>
> Did you read the commentary at the beginning of ctypes.el?
>
The only relevant part seems to be:
 ;; Currently, this package can parse C and C++ files.  (However, since
 ;; I do not use C++, the probability is high (about 12, on a scale
 ;; from 1 to 12) that I've missed something).  By default C++ inherits
 ;; the types defined for C mode.
;-)

I must admit, however, that ctypes.el is quite smart and useful, so the
thread title is unjustified....

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

* Re: ctypes.el is stupid (by default)
  2005-12-29 16:07         ` shreevatsa
@ 2005-12-29 19:34           ` Kevin Rodgers
  0 siblings, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2005-12-29 19:34 UTC (permalink / raw)


shreevatsa wrote:
 > Kevin Rodgers wrote:
 >>One problem is that merely loading ctypes affects subsequent editing.
 >>You could try to disable ctypes with:
 >>(remove-hook 'find-file-hooks 'ctypes-find-file-hook)
 >
 > But I _want_ ctypes.el! It's nice and helpful, although it has a few
 > bugs:
 > 1. STL types not recognized

Where are the STL types defined?

 > 2. In c++-mode, it recognizes a class as a new type, but not a struct
 > (probably because of the way it works in C). Unfortunately, I hardly
 > know any Emacs-lisp, so I can't fix this myself.

I don't know C++, so I can't help either.

 > 3. The link given in ctypes.el, namely
 > http://www.csd.uu.se/~andersl/emacs.shtml does not work. There's even
 > an unanswered post about it at
 > http://list-archive.xemacs.org/xemacs-beta/200311/msg00064.html

Indeed.  emacswiki.org has version 1.2 (dated 12 Jun 1997), but Google
found version 1.3.1 (dated 1999-06-23) at
http://simon.nitro.dk/dotfiles/emacs/ctypes.el

 >>Did you read the commentary at the beginning of ctypes.el?
 >
 > The only relevant part seems to be:
 >  ;; Currently, this package can parse C and C++ files.  (However, since
 >  ;; I do not use C++, the probability is high (about 12, on a scale
 >  ;; from 1 to 12) that I've missed something).  By default C++ inherits
 >  ;; the types defined for C mode.
 > ;-)

This is the part I think is relevant (assuming you can find a
comprehensive list of STL types):

;; Defining types:
;;
;; The following commands are available to define and remove types:
;;
;; `ctypes-define-type'            Add a type.
;; `ctypes-define-type-in-mode'    Add a type to another major mode.
;; `ctypes-buffer'                 Scan a buffer for types.
;; `ctypes-all-buffer'             Scan all buffer for types.
;; `ctypes-tags'                   Search through all files in a TAGS table.
;; `ctypes-dir'                    Search a directory hierarchy for files.
;; `ctypes-file'                   Search in a file for types.
;; `ctypes-remove-type'            Remove one type.
;; `ctypes-remove-type-in-mode'    Remove one type in another mode.
;; `ctypes-clear-types'            Forget all types.
;; `ctypes-clear-types-all-modes'  Forget all types in all major modes.

;; Edit types:
;;
;; If you would like to view or change the types found you can use the
;; function `ctypes-edit'.  When done press C-c C-c.  Should you like
;; do discard your changes just kill the buffer with C-x k.
;;
;; To edit the types for another major mode use the command
;; `ctypes-edit-types-for-mode'.

;; Saving types:
;;
;; The commands `ctypes-write-file' and `ctypes-read-file' can be used
;; to save your hard-earned collection of types to a file and to
;; retrieve it later.
;;
;; The default file name is stored in the variable `ctypes-file-name'.
;;
;; Note that only one collection of types are managed.  Should you
;; prefer to keep one type file per project, remember to clear the set
;; of known types (using the command `ctypes-clear-types-all-modes')
;; before each new set is generated.

;; At Load:
;;
;; It is possible to automatically add new types, or read specific
;; type files, when Emacs opens a file.
;;
;; By adding a "Local Variables" section to the end of the file
;; containing the variables `ctypes-add-types-at-load' and/or
;; `ctypes-read-files-at-load' this can be accomplished.
;;
;; For example:
;;
;; /*
;;  * Local Variables:
;;  * ctypes-add-types-at-load: ("MyType" "YourType")
;;  * ctypes-read-files-at-load: (".ctypes")
;;  * End:
;;  */

;; The `Auto Parse' mode:
;;
;; This package can automatically search for new types in all visited
;; files.  Activate the minor mode `ctypes-auto-parse-mode' to enable
;; this feature.
;;
;; Add the following line to your startup file to automatically
;; scan all visited files:
;;  (ctypes-auto-parse-mode 1)

 > I must admit, however, that ctypes.el is quite smart and useful, so the
 > thread title is unjustified....

-- 
Kevin Rodgers

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

end of thread, other threads:[~2005-12-29 19:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-22  6:17 ctypes.el is stupid (by default) shreevatsa
2005-12-28  7:35 ` shreevatsa
2005-12-28 10:03   ` Matthieu Moy
2005-12-28 17:01     ` shreevatsa
2005-12-28 21:38       ` Kevin Rodgers
     [not found]       ` <mailman.20728.1135806945.20277.help-gnu-emacs@gnu.org>
2005-12-29 16:07         ` shreevatsa
2005-12-29 19:34           ` Kevin Rodgers
2005-12-28 21:36 ` Kevin Rodgers

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).