Editing Emacs
From BRL-CAD
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | There are a variety of settings that you can put into your '''.emacs''' configuration file that | + | There are a variety of settings that you can put into your '''.emacs''' configuration file that can make life easier when working with the BRL-CAD sources. |
<pre> | <pre> | ||
Line 5: | Line 5: | ||
(c-set-offset 'case-label '+) | (c-set-offset 'case-label '+) | ||
(c-set-offset 'statement-case-open '+) | (c-set-offset 'statement-case-open '+) | ||
− | |||
− | |||
;; Support font-locking large files | ;; Support font-locking large files | ||
Line 13: | Line 11: | ||
(transient-mark-mode t) | (transient-mark-mode t) | ||
(turn-on-font-lock) | (turn-on-font-lock) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
; display column numbers in addition to line numbers | ; display column numbers in addition to line numbers | ||
(set-variable 'column-number-mode t) | (set-variable 'column-number-mode t) | ||
− | |||
− | |||
− | |||
;;;;;;;;;;;;;;;; | ;;;;;;;;;;;;;;;; | ||
Line 61: | Line 47: | ||
(interactive) | (interactive) | ||
(save-excursion | (save-excursion | ||
− | |||
(goto-char (point-min)) | (goto-char (point-min)) | ||
− | (while (re-search-forward " | + | (while (re-search-forward ",\\([^[:space:]\n,]\\)" nil t) (replace-match ", \\1")) |
(goto-char (point-min)) | (goto-char (point-min)) | ||
− | (while ( | + | (while (search-forward "( " nil t) (replace-match "(")) |
(goto-char (point-min)) | (goto-char (point-min)) | ||
− | (while ( | + | (while (search-forward " )" nil t) (replace-match ")")) |
(goto-char (point-min)) | (goto-char (point-min)) | ||
− | (while ( | + | (while (search-forward "if(" nil t) (replace-match "if (")) |
(goto-char (point-min)) | (goto-char (point-min)) | ||
− | (while ( | + | (while (search-forward "for(" nil t) (replace-match "for (")) |
(goto-char (point-min)) | (goto-char (point-min)) | ||
− | (while ( | + | (while (search-forward "while(" nil t) (replace-match "while (")) |
(goto-char (point-min)) | (goto-char (point-min)) | ||
− | (while ( | + | (while (search-forward "){" nil t) (replace-match ") {")) |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ")) | ||
(goto-char (point-min)) | (goto-char (point-min)) | ||
− | (while (re-search-forward " | + | (while (re-search-forward ")[[:space:]]+{" nil t) (replace-match ") {")) |
− | [ | ||
− | |||
− | ]+ | ||
− | " nil t) (replace-match " | ||
− | |||
− | |||
− | ")) | ||
(c-set-offset 'case-label '+) | (c-set-offset 'case-label '+) | ||
(c-set-offset 'statement-case-open '+) | (c-set-offset 'statement-case-open '+) | ||
− | |||
− | |||
(indent-region (point-min) (point-max) nil) | (indent-region (point-min) (point-max) nil) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
)) | )) | ||
; custom bindings to support our style idiosyncrasies | ; custom bindings to support our style idiosyncrasies | ||
(global-set-key "\M-0" 'ws) | (global-set-key "\M-0" 'ws) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> |