Mercurial > emacs
comparison lisp/progmodes/verilog-mode.el @ 79554:bc59ec18d036
(verilog-kill-existing-comment, verilog-insert-date)
(verilog-insert-year): Rename in order not to pollute the global
namespace from kill-existing-comment, insert-date and
insert-year, respectively.
(verilog-set-auto-endcomments, verilog-header): Update callers.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sun, 09 Dec 2007 19:38:37 +0000 |
parents | 23c53aca1e84 |
children | 52d2889ab3d8 |
comparison
equal
deleted
inserted
replaced
79553:f81c00b9c0ff | 79554:bc59ec18d036 |
---|---|
3167 | 3167 |
3168 ;; | 3168 ;; |
3169 ;; Other functions | 3169 ;; Other functions |
3170 ;; | 3170 ;; |
3171 | 3171 |
3172 (defun kill-existing-comment () | 3172 (defun verilog-kill-existing-comment () |
3173 "Kill auto comment on this line." | 3173 "Kill auto comment on this line." |
3174 (save-excursion | 3174 (save-excursion |
3175 (let* ( | 3175 (let* ( |
3176 (e (progn | 3176 (e (progn |
3177 (end-of-line) | 3177 (end-of-line) |
3208 m | 3208 m |
3209 (else (if (match-end 2) "!" " ")) | 3209 (else (if (match-end 2) "!" " ")) |
3210 ) | 3210 ) |
3211 (end-of-line) | 3211 (end-of-line) |
3212 (if kill-existing-comment | 3212 (if kill-existing-comment |
3213 (kill-existing-comment)) | 3213 (verilog-kill-existing-comment)) |
3214 (delete-horizontal-space) | 3214 (delete-horizontal-space) |
3215 (save-excursion | 3215 (save-excursion |
3216 (backward-sexp 1) | 3216 (backward-sexp 1) |
3217 (while (and (/= nest 0) | 3217 (while (and (/= nest 0) |
3218 (verilog-re-search-backward verilog-directive-nest-re nil 'move)) | 3218 (verilog-re-search-backward verilog-directive-nest-re nil 'move)) |
3285 (setq str (concat (buffer-substring (match-beginning 1) (match-end 1)) | 3285 (setq str (concat (buffer-substring (match-beginning 1) (match-end 1)) |
3286 " " | 3286 " " |
3287 (verilog-get-expr)))))) | 3287 (verilog-get-expr)))))) |
3288 (end-of-line) | 3288 (end-of-line) |
3289 (if kill-existing-comment | 3289 (if kill-existing-comment |
3290 (kill-existing-comment)) | 3290 (verilog-kill-existing-comment)) |
3291 (delete-horizontal-space) | 3291 (delete-horizontal-space) |
3292 (insert (concat " // " str )) | 3292 (insert (concat " // " str )) |
3293 (if err (ding 't)) | 3293 (if err (ding 't)) |
3294 )) | 3294 )) |
3295 | 3295 |
3307 (if (not (match-end 0)) | 3307 (if (not (match-end 0)) |
3308 (progn | 3308 (progn |
3309 (goto-char here) | 3309 (goto-char here) |
3310 (end-of-line) | 3310 (end-of-line) |
3311 (if kill-existing-comment | 3311 (if kill-existing-comment |
3312 (kill-existing-comment)) | 3312 (verilog-kill-existing-comment)) |
3313 (delete-horizontal-space) | 3313 (delete-horizontal-space) |
3314 (insert str) | 3314 (insert str) |
3315 (ding 't) | 3315 (ding 't) |
3316 ) | 3316 ) |
3317 (let ((lim | 3317 (let ((lim |
3448 | 3448 |
3449 )))) | 3449 )))) |
3450 (goto-char here) | 3450 (goto-char here) |
3451 (end-of-line) | 3451 (end-of-line) |
3452 (if kill-existing-comment | 3452 (if kill-existing-comment |
3453 (kill-existing-comment)) | 3453 (verilog-kill-existing-comment)) |
3454 (delete-horizontal-space) | 3454 (delete-horizontal-space) |
3455 (if (or err | 3455 (if (or err |
3456 (> (count-lines here there) verilog-minimum-comment-distance)) | 3456 (> (count-lines here there) verilog-minimum-comment-distance)) |
3457 (insert str)) | 3457 (insert str)) |
3458 (if err (ding 't)) | 3458 (if err (ding 't)) |
3501 t | 3501 t |
3502 (let (string reg (width nil)) | 3502 (let (string reg (width nil)) |
3503 (end-of-line) | 3503 (end-of-line) |
3504 (if kill-existing-comment | 3504 (if kill-existing-comment |
3505 (save-match-data | 3505 (save-match-data |
3506 (kill-existing-comment))) | 3506 (verilog-kill-existing-comment))) |
3507 (delete-horizontal-space) | 3507 (delete-horizontal-space) |
3508 (backward-sexp) | 3508 (backward-sexp) |
3509 (cond | 3509 (cond |
3510 ((match-end 5) ;; of verilog-end-block-ordered-re | 3510 ((match-end 5) ;; of verilog-end-block-ordered-re |
3511 (setq reg "\\(\\<function\\>\\)\\|\\(\\<\\(endfunction\\|task\\|\\(macro\\)?module\\|primitive\\)\\>\\)") | 3511 (setq reg "\\(\\<function\\>\\)\\|\\(\\<\\(endfunction\\|task\\|\\(macro\\)?module\\|primitive\\)\\>\\)") |
5844 (replace-match (buffer-name) t t) | 5844 (replace-match (buffer-name) t t) |
5845 (search-forward "<author>") (replace-match "" t t) | 5845 (search-forward "<author>") (replace-match "" t t) |
5846 (insert (user-full-name)) | 5846 (insert (user-full-name)) |
5847 (insert " <" (user-login-name) "@" (system-name) ">") | 5847 (insert " <" (user-login-name) "@" (system-name) ">") |
5848 (search-forward "<credate>") (replace-match "" t t) | 5848 (search-forward "<credate>") (replace-match "" t t) |
5849 (insert-date) | 5849 (verilog-insert-date) |
5850 (search-forward "<moddate>") (replace-match "" t t) | 5850 (search-forward "<moddate>") (replace-match "" t t) |
5851 (insert-date) | 5851 (verilog-insert-date) |
5852 (search-forward "<copydate>") (replace-match "" t t) | 5852 (search-forward "<copydate>") (replace-match "" t t) |
5853 (insert-year) | 5853 (verilog-insert-year) |
5854 (search-forward "<modhist>") (replace-match "" t t) | 5854 (search-forward "<modhist>") (replace-match "" t t) |
5855 (insert-date) | 5855 (verilog-insert-date) |
5856 (insert " : created") | 5856 (insert " : created") |
5857 (goto-char start) | 5857 (goto-char start) |
5858 (let (string) | 5858 (let (string) |
5859 (setq string (read-string "title: ")) | 5859 (setq string (read-string "title: ")) |
5860 (search-forward "<title>") | 5860 (search-forward "<title>") |
5875 (replace-match string t t) | 5875 (replace-match string t t) |
5876 (search-backward "<description>") | 5876 (search-backward "<description>") |
5877 (replace-match "" t t) | 5877 (replace-match "" t t) |
5878 ))) | 5878 ))) |
5879 | 5879 |
5880 ;; verilog-header Uses the insert-date function | 5880 ;; verilog-header Uses the verilog-insert-date function |
5881 | 5881 |
5882 (defun insert-date () | 5882 (defun verilog-insert-date () |
5883 "Insert date from the system." | 5883 "Insert date from the system." |
5884 (interactive) | 5884 (interactive) |
5885 (let ((timpos)) | 5885 (let ((timpos)) |
5886 (setq timpos (point)) | 5886 (setq timpos (point)) |
5887 (if verilog-date-scientific-format | 5887 (if verilog-date-scientific-format |
5890 (search-forward "@") | 5890 (search-forward "@") |
5891 (delete-region timpos (point)) | 5891 (delete-region timpos (point)) |
5892 (end-of-line)) | 5892 (end-of-line)) |
5893 (delete-char 1)) | 5893 (delete-char 1)) |
5894 | 5894 |
5895 (defun insert-year () | 5895 (defun verilog-insert-year () |
5896 "Insert year from the system." | 5896 "Insert year from the system." |
5897 (interactive) | 5897 (interactive) |
5898 (let ((timpos)) | 5898 (let ((timpos)) |
5899 (setq timpos (point)) | 5899 (setq timpos (point)) |
5900 (shell-command "date \"+@%Y\"" t) | 5900 (shell-command "date \"+@%Y\"" t) |