[ros-users] rosemacs additions

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Axelrod, Benjamin
Date:  
To: ros-users
Subject: [ros-users] rosemacs additions
I'd like to request some useful additions to rosemacs.el:



;; Add ROS *.launch, *.urdf, and *.xacro files to xml mode

(add-to-list 'auto-mode-alist '("\\.launch\\'" . xml-mode))

(add-to-list 'auto-mode-alist '("\\.urdf\\'" . xml-mode))

(add-to-list 'auto-mode-alist '("\\.xacro\\'" . xml-mode))



;; Add ROS message files to gdb-script mode for syntax highlighting

(add-to-list 'auto-mode-alist '("\\.msg\\'" . gdb-script-mode))

(add-to-list 'auto-mode-alist '("\\.srv\\'" . gdb-script-mode))

(add-to-list 'auto-mode-alist '("\\.action\\'" . gdb-script-mode))



These enable useful syntax highlighting in ros specific files. I found
that gdb-script-mode colors message files very nicely. (Comments are
red, field types are purple, field names are black.) Ideally, I guess
there should be a ros-message-mode with its own font-lock rules. But
this seems to be sufficient for now. To make gdb-script-mode even more
ros-centric, you can add ros's standard message types to a different
font-lock font face. This will make standard field types like "bool"
and "int8" pink instead of purple:



;; Add ROS standard message types to gdb-script-mode for different
highlighting

(font-lock-add-keywords 'gdb-script-mode


'(("\\<\\(bool\\|int8\\|uint8\\|int16\\|uint16\\|int32\\|uint32\\|int64\
\|uint64\\|float32\\|float64\\|string\\|time\\|duration\\)\\>" .
font-lock-builtin-face)))



Enjoy,

-Ben



Ben Axelrod

Research Scientist

iRobot Corporation

8 Crosby Drive, Mail Stop 8-1

Bedford, MA 01730

(781) 430-3315 (Tel)

(781) 960-2628 (Fax)

<mailto:ofitch@irobot.com>