From 574aa4d84389d9d09fc1f0164ac63915082c3845 Mon Sep 17 00:00:00 2001 From: Gonzalo Larumbe Date: Sat, 17 Jun 2023 16:22:37 +0200 Subject: [PATCH] Minor code fixes and doc function renaming --- README.md | 22 +++++++++++----------- verilog-ext-beautify.el | 12 ++++++------ verilog-ext-font-lock.el | 2 +- verilog-ext-hierarchy.el | 4 ++-- verilog-ext-ports.el | 2 +- verilog-ext-template.el | 8 ++++---- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 7e76ccb..e470dfa 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ Enabling of `verilog-ext-mode` minor-mode creates the following keybindings: * Features: * M-i `verilog-ext-imenu-list` - * C-c C-l `verilog-ext-code-format` + * C-c C-l `verilog-ext-formatter-run` * C-c \ `verilog-ext-workspace-compile` * C-c C-p `verilog-ext-preprocess` * C-c C-f `verilog-ext-flycheck-mode` @@ -159,8 +159,8 @@ Enabling of `verilog-ext-mode` minor-mode creates the following keybindings: * C-\ `verilog-ext-hs-toggle-hiding` * Code beautifying - * C-M-i `verilog-ext-indent-block-at-point` - * C-c C-b `verilog-ext-module-at-point-beautify` + * C-M-i `verilog-ext-beautify-block-at-point-indent` + * C-c C-b `verilog-ext-beautify-module-at-point` * Dwim navigation * C-M-a `verilog-ext-nav-beg-of-defun-dwim` @@ -178,9 +178,9 @@ Enabling of `verilog-ext-mode` minor-mode creates the following keybindings: * C-M-. `verilog-ext-workspace-jump-to-parent-module` * Port connections - * C-c C-c c `verilog-ext-clean-port-blanks` - * C-c C-c t `verilog-ext-toggle-connect-port` - * C-c C-c r `verilog-ext-connect-ports-recursively` + * C-c C-c c `verilog-ext-ports-clean-blanks` + * C-c C-c t `verilog-ext-ports-toggle-connect` + * C-c C-c r `verilog-ext-ports-connect-recursively` * Syntax table override functions: * TAB `verilog-ext-tab` @@ -267,13 +267,13 @@ Indent and align parameters and ports of RTL instances. Interactive functions: -* `verilog-ext-module-at-point-beautify`: C-c C-b +* `verilog-ext-beautify-module-at-point`: C-c C-b * `verilog-ext-beautify-current-buffer` Batch-mode functions: * `verilog-ext-beautify-files` -* `verilog-ext-beautify-files-current-dir` +* `verilog-ext-beautify-dir-files` ## Navigation ## @@ -399,9 +399,9 @@ Toggle connections of ports under instance at point - * `verilog-ext-toggle-connect-port`: C-c C-c t - * `verilog-ext-connect-ports-recursively`: C-c C-c r - * `verilog-ext-clean-port-blanks`: C-c C-c c + * `verilog-ext-ports-toggle-connect`: C-c C-c t + * `verilog-ext-ports-connect-recursively`: C-c C-c r + * `verilog-ext-ports-clean-blanks`: C-c C-c c ## Misc ## diff --git a/verilog-ext-beautify.el b/verilog-ext-beautify.el index fd2eea4..01b0b73 100644 --- a/verilog-ext-beautify.el +++ b/verilog-ext-beautify.el @@ -95,10 +95,10 @@ (setq current-module (car current-ids)) (save-excursion (goto-char (match-beginning 0)) - (beginning-of-line) + (goto-char (line-beginning-position)) (setq beg (point)) (goto-char (match-end 0)) - (end-of-line) + (goto-char (line-end-position)) (setq end (point))) (verilog-ext-indent-region beg end) (message "Indented %s" current-module))) @@ -136,10 +136,10 @@ FILES is a list of strings containing the filepaths." (error "File %s does not exist! Aborting!" file))) (save-window-excursion (dolist (file files) - (find-file file) - (verilog-mode) - (verilog-ext-beautify-current-buffer) - (write-file file)))) + (with-temp-file file + (insert-file-contents file) + (verilog-mode) + (verilog-ext-beautify-current-buffer))))) (defun verilog-ext-beautify-dir-files (dir) "Beautify Verilog files on DIR." diff --git a/verilog-ext-font-lock.el b/verilog-ext-font-lock.el index 4943c17..adf7b4c 100644 --- a/verilog-ext-font-lock.el +++ b/verilog-ext-font-lock.el @@ -525,7 +525,7 @@ Bound search by LIMIT." (while (and (not found) (verilog-re-search-forward decl-typedef-re limit t)) (when (save-excursion - (beginning-of-line) + (goto-char (line-beginning-position)) (looking-at decl-typedef-re)) (setq found t))) (when found diff --git a/verilog-ext-hierarchy.el b/verilog-ext-hierarchy.el index 2840d18..57f7d78 100644 --- a/verilog-ext-hierarchy.el +++ b/verilog-ext-hierarchy.el @@ -342,7 +342,7 @@ Move through headings and point at the beginning of the tag." (declare (indent 0) (debug t)) `(defun ,verilog-ext-func () (interactive) - (beginning-of-line) ; Required for `outline-hide-sublevels' + (goto-char (line-beginning-position)) ; Required for `outline-hide-sublevels' (call-interactively ,outshine-func) (skip-chars-forward (car (car outshine-promotion-headings))))) @@ -414,7 +414,7 @@ Expects HIERARCHY to be a indented string." (goto-char (point-min)) (re-search-forward "// \\* ") (when (re-search-forward "// \\* " nil t) - (beginning-of-line) + (goto-char (line-beginning-position)) (open-line 3) (forward-line 2) (insert "// * Not found module references") diff --git a/verilog-ext-ports.el b/verilog-ext-ports.el index 14a3262..90084c2 100644 --- a/verilog-ext-ports.el +++ b/verilog-ext-ports.el @@ -58,7 +58,7 @@ of current port instead of toggling." (re (concat "\\(?1:^\\s-*\\)\\.\\(?2:" verilog-identifier-re "\\)\\(?3:\\s-*\\)\\(?4:(\\s-*\\(?5:" verilog-identifier-re "\\)*\\s-*)\\)?")) port-found port conn sig) (save-excursion - (beginning-of-line) + (goto-char (line-beginning-position)) (if (looking-at re) (progn (setq port-found t) diff --git a/verilog-ext-template.el b/verilog-ext-template.el index ab14ad6..e74313c 100644 --- a/verilog-ext-template.el +++ b/verilog-ext-template.el @@ -461,7 +461,7 @@ Syntactic sugar for `verilog-ext-template-inst-auto-from-file'." (verilog-ext-replace-string "/*AUTOINSTPARAM*/" "" beg end) ;; Remove ' // Parameters ' string (forward-line 1) - (beginning-of-line) + (goto-char (line-beginning-position)) (kill-line 1)))) (defun verilog-ext-template-inst-auto-from-file (file &optional template inst-template) @@ -657,15 +657,15 @@ endmodule // tb_ (point) (verilog-pos-at-end-of-statement))) (save-excursion (while (re-search-forward "/\\*AUTO.*\*\/" nil t) - (beginning-of-line) + (goto-char (line-beginning-position)) (kill-line 1))) (save-excursion (while (search-forward "// Beginning of automatic" nil t) - (beginning-of-line) + (goto-char (line-beginning-position)) (kill-line 1))) (save-excursion (while (search-forward "// End of automatics" nil t) - (beginning-of-line) + (goto-char (line-beginning-position)) (kill-line 1))) (search-forward "// TODO") (write-file outfile)))