diff options
Diffstat (limited to 'lisp/progmodes')
| -rw-r--r-- | lisp/progmodes/ada-mode.el | 113 | ||||
| -rw-r--r-- | lisp/progmodes/ada-xref.el | 25 | ||||
| -rw-r--r-- | lisp/progmodes/compile.el | 8 | ||||
| -rw-r--r-- | lisp/progmodes/cperl-mode.el | 13 | ||||
| -rw-r--r-- | lisp/progmodes/gdb-ui.el | 6 | ||||
| -rw-r--r-- | lisp/progmodes/grep.el | 3 | ||||
| -rw-r--r-- | lisp/progmodes/meta-mode.el | 153 | ||||
| -rw-r--r-- | lisp/progmodes/perl-mode.el | 12 | ||||
| -rw-r--r-- | lisp/progmodes/scheme.el | 1 | ||||
| -rw-r--r-- | lisp/progmodes/vhdl-mode.el | 11 |
10 files changed, 224 insertions, 121 deletions
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el index c9a69005eaf..aa3aea0d71b 100644 --- a/lisp/progmodes/ada-mode.el +++ b/lisp/progmodes/ada-mode.el @@ -829,13 +829,12 @@ the 4 file locations can be clicked on and jumped to." ;; Thus their syntax property is changed automatically, and we can still use ;; the standard Emacs functions for sexp (see `ada-in-string-p') ;; -;; On Emacs, this is done through the `syntax-table' text property. The -;; modification is done automatically each time the user as typed a new -;; character. This is already done in `font-lock-mode' (in -;; `font-lock-syntactic-keywords', so we take advantage of the existing -;; mechanism. If font-lock-mode is not activated, we do it by hand in -;; `ada-after-change-function', thanks to `ada-deactivate-properties' and -;; `ada-initialize-properties'. +;; On Emacs, this is done through the `syntax-table' text property. The +;; corresponding action is applied automatically each time the buffer +;; changes. If `font-lock-mode' is enabled (the default) the action is +;; set up by `font-lock-syntactic-keywords'. Otherwise, we do it +;; manually in `ada-after-change-function'. The proper method is +;; installed by `ada-handle-syntax-table-properties'. ;; ;; on XEmacs, the `syntax-table' property does not exist and we have to use a ;; slow advice to `parse-partial-sexp' to do the same thing. @@ -852,7 +851,6 @@ The standard table declares `_' as a symbol constituent, the second one declares it as a word constituent." (interactive) (setq ada-mode-syntax-table (make-syntax-table)) - (set-syntax-table ada-mode-syntax-table) ;; define string brackets (`%' is alternative string bracket, but ;; almost never used as such and throws font-lock and indentation @@ -936,50 +934,59 @@ declares it as a word constituent." (insert (caddar change)) (setq change (cdr change))))))) -(defun ada-deactivate-properties () - "Deactivate Ada mode's properties handling. -This would be a duplicate of font-lock if both are used at the same time." - (remove-hook 'after-change-functions 'ada-after-change-function t)) - -(defun ada-initialize-properties () - "Initialize some special text properties in the whole buffer. -In particular, character constants are said to be strings, #...# are treated -as numbers instead of gnatprep comments." - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (while (re-search-forward "'.'" nil t) - (add-text-properties (match-beginning 0) (match-end 0) - '(syntax-table ("'" . ?\")))) - (goto-char (point-min)) - (while (re-search-forward "^[ \t]*#" nil t) - (add-text-properties (match-beginning 0) (match-end 0) - '(syntax-table (11 . 10)))) - (set-buffer-modified-p nil) - - ;; Setting this only if font-lock is not set won't work - ;; if the user activates or deactivates font-lock-mode, - ;; but will make things faster most of the time - (add-hook 'after-change-functions 'ada-after-change-function nil t) - ))) +(defun ada-set-syntax-table-properties () + "Assign `syntax-table' properties in accessible part of buffer. +In particular, character constants are said to be strings, #...# +are treated as numbers instead of gnatprep comments." + (let ((modified (buffer-modified-p)) + (buffer-undo-list t) + (inhibit-read-only t) + (inhibit-point-motion-hooks t) + (inhibit-modification-hooks t)) + (remove-text-properties (point-min) (point-max) '(syntax-table nil)) + (goto-char (point-min)) + (while (re-search-forward + ;; The following regexp was adapted from + ;; `ada-font-lock-syntactic-keywords'. + "^[ \t]*\\(#\\(?:if\\|else\\|elsif\\|end\\)\\)\\|[^a-zA-Z0-9)]\\('\\)[^'\n]\\('\\)" + nil t) + (if (match-beginning 1) + (put-text-property + (match-beginning 1) (match-end 1) 'syntax-table '(11 . ?\n)) + (put-text-property + (match-beginning 2) (match-end 2) 'syntax-table '(7 . ?')) + (put-text-property + (match-beginning 3) (match-end 3) 'syntax-table '(7 . ?')))) + (unless modified + (restore-buffer-modified-p nil)))) (defun ada-after-change-function (beg end old-len) "Called when the region between BEG and END was changed in the buffer. OLD-LEN indicates what the length of the replaced text was." - (let ((inhibit-point-motion-hooks t) - (eol (point))) + (save-excursion + (save-restriction + (let ((from (progn (goto-char beg) (line-beginning-position))) + (to (progn (goto-char end) (line-end-position)))) + (narrow-to-region from to) + (save-match-data + (ada-set-syntax-table-properties)))))) + +(defun ada-initialize-syntax-table-properties () + "Assign `syntax-table' properties in current buffer." (save-excursion - (save-match-data - (beginning-of-line) - (remove-text-properties (point) eol '(syntax-table nil)) - (while (re-search-forward "'.'" eol t) - (add-text-properties (match-beginning 0) (match-end 0) - '(syntax-table ("'" . ?\")))) - (beginning-of-line) - (if (looking-at "^[ \t]*#") - (add-text-properties (match-beginning 0) (match-end 0) - '(syntax-table (11 . 10)))))))) + (save-restriction + (widen) + (save-match-data + (ada-set-syntax-table-properties)))) + (add-hook 'after-change-functions 'ada-after-change-function nil t)) + +(defun ada-handle-syntax-table-properties () + "Handle `syntax-table' properties." + (if font-lock-mode + ;; `font-lock-mode' will take care of `syntax-table' properties. + (remove-hook 'after-change-functions 'ada-after-change-function t) + ;; Take care of `syntax-table' properties manually. + (ada-initialize-syntax-table-properties))) ;;------------------------------------------------------------------ ;; Testing the grammatical context @@ -1150,6 +1157,8 @@ If you use ada-xref.el: (interactive) (kill-all-local-variables) + + (set-syntax-table ada-mode-syntax-table) (set (make-local-variable 'require-final-newline) mode-require-final-newline) @@ -1340,7 +1349,7 @@ If you use ada-xref.el: (setq which-func-functions '(ada-which-function)) ;; Support for indent-new-comment-line (Especially for XEmacs) - (setq comment-multi-line nil) + (set (make-local-variable 'comment-multi-line) nil) (setq major-mode 'ada-mode mode-name "Ada") @@ -1377,9 +1386,8 @@ If you use ada-xref.el: ;; font-lock-mode (unless (featurep 'xemacs) - (progn - (ada-initialize-properties) - (add-hook 'font-lock-mode-hook 'ada-deactivate-properties nil t))) + (ada-initialize-syntax-table-properties) + (add-hook 'font-lock-mode-hook 'ada-handle-syntax-table-properties nil t)) ;; the following has to be done after running the ada-mode-hook ;; because users might want to set the values of these variable @@ -5200,8 +5208,7 @@ Return nil if no body was found." ;; This sets the properties of the characters, so that ada-in-string-p ;; correctly handles '"' too... '(("[^a-zA-Z0-9)]\\('\\)[^'\n]\\('\\)" (1 (7 . ?')) (2 (7 . ?'))) - ("^[ \t]*\\(#\\(if\\|else\\|elsif\\|end\\)\\)" (1 (11 . ?\n))) - )) + ("^[ \t]*\\(#\\(if\\|else\\|elsif\\|end\\)\\)" (1 (11 . ?\n))))) (defvar ada-font-lock-keywords (eval-when-compile diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el index e8db3d51c2a..c37d11910d4 100644 --- a/lisp/progmodes/ada-xref.el +++ b/lisp/progmodes/ada-xref.el @@ -71,7 +71,7 @@ Set to 0, if you don't use crunched filenames. This should be a string." :type 'string :group 'ada) (defcustom ada-gnatls-args '("-v") - "*Arguments to pass to `gnatfind' to find location of the runtime. + "*Arguments to pass to `gnatls' to find location of the runtime. Typical use is to pass `--RTS=soft-floats' on some systems that support it. You can also add `-I-' if you do not want the current directory to be included. @@ -322,7 +322,6 @@ CROSS-PREFIX is the prefix to use for the `gnatls' command." (reverse ada-xref-runtime-library-ali-path)) )) - (defun ada-treat-cmd-string (cmd-string) "Replace meta-sequences like ${...} in CMD-STRING with the appropriate value. Assumes project exists. @@ -345,7 +344,7 @@ replaced by the name including the extension." ;; Check if there is an environment variable with the same name (if (null value) (if (not (setq value (getenv name))) - (message "%s" (concat "No environment variable " name " found")))) + (message "%s" (concat "No project or environment variable " name " found")))) (cond ((null value) @@ -535,6 +534,11 @@ All the directories are returned as absolute directories." Completion is attempted in all the directories in the source path, as defined in the project file." ;; FIXME: doc arguments + + ;; This function is not itself interactive, but it is called as part + ;; of the prompt of interactive functions, so we require a project + ;; file. + (ada-require-project-file) (let (list (dirs (ada-xref-get-src-dir-field))) @@ -663,9 +667,6 @@ is non-nil, prompt the user to select one. If none are found, return ada-prj-file-extension)) (dir (file-name-directory current-file)) - ;; on Emacs 20.2, directory-files does not work if - ;; parse-sexp-lookup-properties is set - (parse-sexp-lookup-properties nil) (prj-files (directory-files dir t (concat ".*" (regexp-quote @@ -905,6 +906,8 @@ If ARG is t, the contents of the old *gnatfind* buffer is preserved." (interactive "d\nP") (ada-find-references pos arg t)) +(defconst ada-gnatfind-buffer-name "*gnatfind*") + (defun ada-find-any-references (entity &optional file line column local-only append) "Search for references to any entity whose name is ENTITY. @@ -943,23 +946,25 @@ buffer `*gnatfind*', if there is one." (setq command (concat command " -P" ada-prj-default-project-file)) (setq command (concat command " -p" ada-prj-default-project-file)))) - (if (and append (get-buffer "*gnatfind*")) + (if (and append (get-buffer ada-gnatfind-buffer-name)) (save-excursion (set-buffer "*gnatfind*") (setq old-contents (buffer-string)))) (let ((compilation-error "reference")) - (compilation-start command)) + (compilation-start command 'compilation-mode (lambda (mode) ada-gnatfind-buffer-name))) ;; Hide the "Compilation" menu (save-excursion - (set-buffer "*gnatfind*") + (set-buffer ada-gnatfind-buffer-name) (local-unset-key [menu-bar compilation-menu]) (if old-contents (progn (goto-char 1) + (set 'buffer-read-only nil) (insert old-contents) + (set 'buffer-read-only t) (goto-char (point-max))))) ) ) @@ -1940,7 +1945,7 @@ This function attempts to find the possible declarations for the identifier anywhere in the object path. This command requires the external `egrep' program to be available. -This works well when one is using an external librarie and wants to find +This works well when one is using an external library and wants to find the declaration and documentation of the subprograms one is using." ;; FIXME: what does this function do? (let (list diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 805ed3c4040..9b83cfc9f3d 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1972,7 +1972,13 @@ The file-structure looks like this: ;; Store it for the possibly unnormalized name (puthash file ;; Retrieve or create file-structure for normalized name - (or (gethash (list filename) compilation-locs) + ;; The gethash used to not use spec-directory, but + ;; this leads to errors when files in different + ;; directories have the same name: + ;; http://lists.gnu.org/archive/html/emacs-devel/2007-08/msg00463.html + (or (gethash (cons filename spec-directory) compilation-locs) + ;; TODO should this, without spec-directory, be + ;; done at all? (puthash (list filename) (list (list filename spec-directory) fmt) compilation-locs)) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index cd7dabb8825..5a91141db6c 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -3736,8 +3736,12 @@ Should be called with the point before leading colon of an attribute." (set-syntax-table reset-st)))) (defsubst cperl-look-at-leading-count (is-x-REx e) - (if (re-search-forward (concat "\\=" (if is-x-REx "[ \t\n]*" "") "[{?+*]") - (1- e) t) ; return nil on failure, no moving + (if (and (> (point) e) + ;; return nil on failure, no moving + (re-search-forward (concat "\\=" + (if is-x-REx "[ \t\n]*" "") + "[{?+*]") + (1- e) t)) (if (eq ?\{ (preceding-char)) nil (cperl-postpone-fontification (1- (point)) (point) @@ -3750,7 +3754,7 @@ If `cperl-pod-here-fontify' is not-nil after evaluation, will fontify the sections using `cperl-pod-head-face', `cperl-pod-face', `cperl-here-face'." (interactive) - (or min (setq min (point-min) + (or min (setq min (point-min) cperl-syntax-state nil cperl-syntax-done-to min)) (or max (setq max (point-max))) @@ -4785,7 +4789,8 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', (progn (cperl-postpone-fontification (1- e1) e1 'face my-cperl-delimiters-face) - (if (assoc (char-after b) cperl-starters) + (if (and (not (eobp)) + (assoc (char-after b) cperl-starters)) (progn (cperl-postpone-fontification b1 (1+ b1) 'face my-cperl-delimiters-face) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index c4d14462245..716b79138f9 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -1132,10 +1132,10 @@ This filter may simply queue input for a later time." (let ((item (concat string "\n"))) (if gdb-enable-debug (push (cons 'send item) gdb-debug-log)) (process-send-string proc item))) - (if (and (string-match "\\\\$" string) - (not comint-input-sender-no-newline)) ;;Try to catch C-d. + (if (string-match "\\\\\\'" string) (setq gdb-continuation (concat gdb-continuation string "\n")) - (let ((item (concat gdb-continuation string "\n"))) + (let ((item (concat gdb-continuation string + (if (not comint-input-sender-no-newline) "\n")))) (gdb-enqueue-input item) (setq gdb-continuation nil))))) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index bafe42b950f..91518641938 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -770,7 +770,8 @@ This command shares argument histories with \\[rgrep] and \\[grep]." ;; even when async processes aren't supported. (compilation-start (if (and grep-use-null-device null-device) (concat command " " null-device) - command) 'grep-mode)) + command) + 'grep-mode)) (if (eq next-error-last-buffer (current-buffer)) (setq default-directory dir)))))) diff --git a/lisp/progmodes/meta-mode.el b/lisp/progmodes/meta-mode.el index a2fd9cdab04..6b911dd1e7a 100644 --- a/lisp/progmodes/meta-mode.el +++ b/lisp/progmodes/meta-mode.el @@ -51,7 +51,7 @@ ;; these lines to your startup file: ;; ;; (add-hook 'meta-mode-load-hook -;; '(lambda () (require 'meta-buf))) +;; (lambda () (require 'meta-buf))) ;; ;; The add-on package loaded this way may in turn make use of the ;; mode-hooks provided in this package to activate additional features @@ -605,14 +605,16 @@ If the list was changed, sort the list and remove duplicates first." (defun meta-indent-calculate () "Return the indentation of current line of Metafont or MetaPost source." + ;; Indentation within strings is not considered as Meta* don't allow multi + ;; line strings. (save-excursion (back-to-indentation) (cond - ;; Comments to the left margin. + ;; Comments to the left margin. ((and meta-left-comment-regexp (looking-at meta-left-comment-regexp)) 0) - ;; Comments to the right margin. + ;; Comments to the right margin. ((and meta-right-comment-regexp (looking-at meta-right-comment-regexp)) comment-column) @@ -620,42 +622,113 @@ If the list was changed, sort the list and remove duplicates first." ((and meta-ignore-comment-regexp (looking-at meta-ignore-comment-regexp)) (current-indentation)) + ;; Beginning of buffer. + ((eq (point-at-bol) (point-min)) + 0) ;; Backindent at end of environments. - ((looking-at + ((meta-indent-looking-at-code (concat "\\<" meta-end-environment-regexp "\\>")) - (- (meta-indent-calculate-last) meta-indent-level)) + (- (meta-indent-current-indentation) meta-indent-level)) ;; Backindent at keywords within environments. - ((looking-at + ((meta-indent-looking-at-code (concat "\\<" meta-within-environment-regexp "\\>")) - (- (meta-indent-calculate-last) meta-indent-level)) - (t (meta-indent-calculate-last))))) - -(defun meta-indent-calculate-last () - "Return the indentation of previous line of Metafont or MetaPost source." - (save-restriction - (widen) + (- (meta-indent-current-indentation) meta-indent-level)) + (t (meta-indent-current-indentation))))) + +(defun meta-indent-in-string-p () + "Tell if the point is in a string." + (or (nth 3 (syntax-ppss)) + (eq (get-text-property (point) 'face) font-lock-string-face))) + +(defun meta-indent-looking-at-code (regexp) + "Same as `looking-at' but checks that the point is not in a string." + (unless (meta-indent-in-string-p) + (looking-at regexp))) + +(defun meta-indent-previous-line () + "Go to the previous line of code, skipping comments." + (skip-chars-backward "\n\t ") + (move-to-column (current-indentation)) + ;; Ignore comments. + (while (and (looking-at comment-start) (not (bobp))) (skip-chars-backward "\n\t ") - (move-to-column (current-indentation)) - ;; Ignore comments. - (while (and (looking-at comment-start) (not (bobp))) - (skip-chars-backward "\n\t ") - (if (not (bobp)) - (move-to-column (current-indentation)))) - (cond - ((bobp) 0) - (t (+ (current-indentation) - (meta-indent-level-count) - (cond - ;; Compensate for backindent at end of environments. - ((looking-at - (concat "\\<"meta-end-environment-regexp "\\>")) - meta-indent-level) - ;; Compensate for backindent within environments. - ((looking-at - (concat "\\<" meta-within-environment-regexp "\\>")) - meta-indent-level) - (t 0))))) - )) + (if (not (bobp)) + (move-to-column (current-indentation))))) + +(defun meta-indent-unfinished-line () + "Tell if the current line of code ends with an unfinished expression." + (save-excursion + (end-of-line) + ;; Skip backward the comments. + (while (search-backward comment-start (point-at-bol) t)) + ;; Search for the end of the previous expression. + (if (search-backward ";" (point-at-bol) t) + (progn (while (and (meta-indent-in-string-p) + (search-backward ";" (point-at-bol) t))) + (if (= (char-after) ?\;) + (forward-char) + (beginning-of-line))) + (beginning-of-line)) + ;; See if the last statement of the line is environment-related, + ;; or exists at all. + (if (meta-indent-looking-at-code + (concat "[ \t]*\\($\\|" (regexp-quote comment-start) + "\\|\\<" meta-end-environment-regexp "\\>" + "\\|\\<" meta-begin-environment-regexp "\\>" + "\\|\\<" meta-within-environment-regexp "\\>\\)")) + nil + t))) + +(defun meta-indent-current-indentation () + "Return the indentation wanted for the current line of code." + (+ (meta-indent-current-nesting) + (if (save-excursion + (back-to-indentation) + (and (not (looking-at (concat "\\<" meta-end-environment-regexp "\\>" + "\\|\\<" meta-within-environment-regexp "\\>"))) + (progn (meta-indent-previous-line) + (meta-indent-unfinished-line)))) + meta-indent-level + 0))) + +(defun meta-indent-current-nesting () + "Return the indentation according to the nearest environment keyword." + (save-excursion + (save-restriction + (widen) + (back-to-indentation) + (let ((to-add 0)) + ;; If we found some environment marker backward... + (if (catch 'found + (while (re-search-backward + (concat "(\\|)\\|\\<" meta-end-environment-regexp "\\>" + "\\|\\<" meta-begin-environment-regexp "\\>" + "\\|\\<" meta-within-environment-regexp "\\>") + nil t) + ;; If we aren't in a string or in a comment, we've found something. + (unless (or (meta-indent-in-string-p) + (nth 4 (syntax-ppss))) + (cond ((= (char-after) ?\() + (setq to-add (+ to-add meta-indent-level))) + ((= (char-after) ?\)) + (setq to-add (- to-add meta-indent-level))) + (t (throw 'found t)))))) + (progn + ;; ... then use it to compute the current indentation. + (back-to-indentation) + (+ to-add (current-indentation) (meta-indent-level-count) + ;; Compensate for backindent of end and within keywords. + (if (meta-indent-looking-at-code + (concat "\\<" meta-end-environment-regexp "\\>\\|" + "\\<" meta-within-environment-regexp "\\>")) + meta-indent-level + ;; Compensate for unfinished line. + (if (save-excursion + (meta-indent-previous-line) + (meta-indent-unfinished-line)) + (- meta-indent-level) + 0)))) + 0))))) (defun meta-indent-level-count () "Count indentation change for begin-end commands in the current line." @@ -671,18 +744,12 @@ If the list was changed, sort the list and remove duplicates first." (goto-char (match-beginning 0)) (cond ;; Count number of begin-end keywords within line. - ((looking-at + ((meta-indent-looking-at-code (concat "\\<" meta-begin-environment-regexp "\\>")) (setq count (+ count meta-indent-level))) - ((looking-at + ((meta-indent-looking-at-code (concat "\\<" meta-end-environment-regexp "\\>")) - (setq count (- count meta-indent-level))) - ;; Count number of open-close parentheses within line. - ((looking-at "(") - (setq count (+ count meta-indent-level))) - ((looking-at ")") - (setq count (- count meta-indent-level))) - ))) + (setq count (- count meta-indent-level)))))) count)))) diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index cfef0eedfe4..f2feff595bb 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -267,8 +267,16 @@ The expansion is entirely correct because it uses the C preprocessor." ("^[ \t]*format.*=[ \t]*\\(\n\\)" (1 '(7))) ;; Funny things in sub arg specifications like `sub myfunc ($$)' ("\\<sub\\s-+\\S-+\\s-*(\\([^)]+\\))" 1 '(1)) - ;; regexp and funny quotes - ("[?:.,;=!~({[][ \t\n]*\\(/\\)" (1 '(7))) + ;; Regexp and funny quotes. + ("\\(?:[?:.,;=!~({[]\\|\\(^\\)\\)[ \t\n]*\\(/\\)" + (2 (if (and (match-end 1) + (save-excursion + (goto-char (match-end 1)) + (skip-chars-backward " \t\n") + (not (memq (char-before) + '(?? ?: ?. ?, ?\; ?= ?! ?~ ?\( ?\[))))) + nil ;; A division sign instead of a regexp-match. + '(7)))) ("\\(^\\|[?:.,;=!~({[ \t]\\)\\([msy]\\|q[qxrw]?\\|tr\\)\\>\\s-*\\([^])}> \n\t]\\)" ;; Nasty cases: ;; /foo/m $a->m $#m $m @m %m diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el index 5bf7cb1e9eb..e5fb8cbc7f8 100644 --- a/lisp/progmodes/scheme.el +++ b/lisp/progmodes/scheme.el @@ -156,6 +156,7 @@ ;; Look within the line for a ; following an even number of backslashes ;; after either a non-backslash or the line beginning. (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+[ \t]*") + (set (make-local-variable 'font-lock-comment-start-skip) ";+ *") (make-local-variable 'comment-column) (setq comment-column 40) (make-local-variable 'parse-sexp-ignore-comments) diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index a1bd32a313d..0d909a4a3ff 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -6982,10 +6982,13 @@ only-lines." (when (and vhdl-progress-info (not noninteractive) (< vhdl-progress-interval (- (nth 1 (current-time)) (aref vhdl-progress-info 2)))) - (message (concat string "... (%2d%s)") - (/ (* 100 (- pos (aref vhdl-progress-info 0))) - (- (aref vhdl-progress-info 1) - (aref vhdl-progress-info 0))) "%") + (let ((delta (- (aref vhdl-progress-info 1) + (aref vhdl-progress-info 0)))) + (if (= 0 delta) + (message (concat string "... (100%s)") "%") + (message (concat string "... (%2d%s)") + (/ (* 100 (- pos (aref vhdl-progress-info 0))) + delta) "%"))) (aset vhdl-progress-info 2 (nth 1 (current-time))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
