From c99904740ebcfde5533c29798618b968d56c0bf4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 15 May 2013 14:31:51 -0400 Subject: * lisp/nxml/nxml-mode.el: Treat unclosed <[[, + + * nxml/nxml-mode.el: Treat unclosed <[[, - * progmodes/octave.el (octave-goto-function-definition): Improve - and fix callers. + * progmodes/octave.el (octave-goto-function-definition): + Improve and fix callers. 2013-05-15 Stefan Monnier @@ -277,7 +304,8 @@ their declaration. (vhdl-mode-syntax-table-init): Remove. - * progmodes/m4-mode.el (m4-mode-syntax-table): Add comment on last change. + * progmodes/m4-mode.el (m4-mode-syntax-table): Add comment on + last change. * progmodes/ld-script.el (ld-script-mode-syntax-table): Use symbol syntax for "_". @@ -292,7 +320,8 @@ Handle a _ with symbol syntax. (autoconf-mode): Don't change the syntax-table for imenu and font-lock. - * progmodes/ada-mode.el (ada-mode-abbrev-table): Consolidate declaration. + * progmodes/ada-mode.el (ada-mode-abbrev-table): + Consolidate declaration. (ada-mode-syntax-table, ada-mode-symbol-syntax-table): Initialize in the declaration. (ada-create-syntax-table): Remove. diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 44271a689cf..c45196f0316 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -352,11 +352,6 @@ Use `nxml-parent-document-set' to set it.") See the function `xmltok-forward-prolog' for more information.") (make-variable-buffer-local 'nxml-prolog-regions) -(defvar nxml-last-fontify-end nil - "Position where fontification last ended. -It is nil if the buffer changed since the last fontification.") -(make-variable-buffer-local 'nxml-last-fontify-end) - (defvar nxml-degraded nil "Non-nil if currently operating in degraded mode. Degraded mode is enabled when an internal error is encountered in the @@ -538,7 +533,6 @@ Many aspects this mode can be customized using (save-excursion (save-restriction (widen) - (nxml-clear-dependent-regions (point-min) (point-max)) (setq nxml-scan-end (copy-marker (point-min) nil)) (with-silent-modifications (nxml-clear-inside (point-min) (point-max)) @@ -583,12 +577,9 @@ Many aspects this mode can be customized using ;; Clean up fontification. (save-excursion (widen) - (let ((inhibit-read-only t) - (buffer-undo-list t) - (modified (buffer-modified-p))) + (with-silent-modifications (nxml-with-invisible-motion - (remove-text-properties (point-min) (point-max) '(face))) - (set-buffer-modified-p modified))) + (remove-text-properties (point-min) (point-max) '(face))))) (remove-hook 'change-major-mode-hook 'nxml-cleanup t)) (defun nxml-degrade (context err) @@ -638,10 +629,6 @@ the full extent of the area needing refontification. For bookkeeping, call this function even when fontification is disabled." (let ((pre-change-end (+ start pre-change-length))) - (setq start - (nxml-adjust-start-for-dependent-regions start - end - pre-change-length)) ;; If the prolog might have changed, rescan the prolog (when (<= start ;; Add 2 so as to include the < and following char that @@ -902,26 +889,16 @@ Called with `font-lock-beg' and `font-lock-end' dynamically bound." (defun nxml-extend-after-change-region (start end pre-change-length) (unless nxml-degraded - (setq nxml-last-fontify-end nil) - (let ((region (nxml-with-degradation-on-error - 'nxml-extend-after-change-region - (save-excursion - (save-restriction - (widen) - (save-match-data - (nxml-with-invisible-motion - (with-silent-modifications - (nxml-extend-after-change-region1 - start end pre-change-length))))))))) - (if (consp region) region)))) - -(defun nxml-extend-after-change-region1 (start end pre-change-length) - (let* ((region (nxml-after-change1 start end pre-change-length)) - (font-lock-beg (car region)) - (font-lock-end (cdr region))) - - (nxml-extend-region) - (cons font-lock-beg font-lock-end))) + (nxml-with-degradation-on-error + 'nxml-extend-after-change-region + (save-excursion + (save-restriction + (widen) + (save-match-data + (nxml-with-invisible-motion + (with-silent-modifications + (nxml-after-change1 + start end pre-change-length))))))))) (defun nxml-fontify-matcher (bound) "Called as font-lock keyword matcher." @@ -936,13 +913,12 @@ Called with `font-lock-beg' and `font-lock-end' dynamically bound." (nxml-fontify-prolog) (goto-char nxml-prolog-end)) - (let (xmltok-dependent-regions - xmltok-errors) + (let (xmltok-errors) (while (and (nxml-tokenize-forward) (<= (point) bound)) ; Intervals are open-ended. (nxml-apply-fontify-rule))) - (setq nxml-last-fontify-end (point))) + ) ;; Since we did the fontification internally, tell font-lock to not ;; do anything itself. diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el index 5bc4d74456b..ac4e9ac4cd9 100644 --- a/lisp/nxml/nxml-rap.el +++ b/lisp/nxml/nxml-rap.el @@ -69,18 +69,6 @@ ;; typical proportion of comments, CDATA sections and processing ;; instructions is small relative to other things. Secondly, to scan ;; we just search for the regexp <[!?]. -;; -;; One problem is unclosed comments, processing instructions and CDATA -;; sections. Suppose, for example, we encounter a . This is not an unexpected situation if the user is -;; creating a comment. It is not helpful to treat the whole of the -;; file starting from the gets added to the buffer after the unclosed ") - (xmltok-add-dependent 'xmltok-unclosed-reparse-p - nil - nil - ;; not --> because - ;; -- is not allowed - ;; in comments in XML - "--") - 'not-well-formed) - ((eq (char-after) ?>) - (goto-char (1+ (point))) - 'comment) - (t - (xmltok-add-dependent - 'xmltok-semi-closed-reparse-p - nil - (point) - "--" - 2) - ;; just include the \"" (interactive "p") (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal))) - (if (= (preceding-char) last-input-event) + (if (= (preceding-char) vhdl-last-input-event) (progn (delete-char -1) (insert-char ?\" 1)) (insert-char ?\' 1)) (self-insert-command count))) @@ -8399,7 +8632,7 @@ is omitted or nil." (defun vhdl-electric-semicolon (count) "';;' --> ' : ', ': ;' --> ' := '" (interactive "p") (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal))) - (cond ((= (preceding-char) last-input-event) + (cond ((= (preceding-char) vhdl-last-input-event) (progn (delete-char -1) (unless (eq (preceding-char) ? ) (insert " ")) (insert ": ") @@ -8413,7 +8646,7 @@ is omitted or nil." (defun vhdl-electric-comma (count) "',,' --> ' <= '" (interactive "p") (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal))) - (cond ((= (preceding-char) last-input-event) + (cond ((= (preceding-char) vhdl-last-input-event) (progn (delete-char -1) (unless (eq (preceding-char) ? ) (insert " ")) (insert "<= "))) @@ -8423,7 +8656,7 @@ is omitted or nil." (defun vhdl-electric-period (count) "'..' --> ' => '" (interactive "p") (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal))) - (cond ((= (preceding-char) last-input-event) + (cond ((= (preceding-char) vhdl-last-input-event) (progn (delete-char -1) (unless (eq (preceding-char) ? ) (insert " ")) (insert "=> "))) @@ -8433,7 +8666,7 @@ is omitted or nil." (defun vhdl-electric-equal (count) "'==' --> ' == '" (interactive "p") (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal))) - (cond ((= (preceding-char) last-input-event) + (cond ((= (preceding-char) vhdl-last-input-event) (progn (delete-char -1) (unless (eq (preceding-char) ? ) (insert " ")) (insert "== "))) @@ -8704,12 +8937,13 @@ since these are almost equivalent)." "[COMPONENT | ENTITY | CONFIGURATION]" " " t)) (setq unit (upcase (or unit ""))) (cond ((equal unit "ENTITY") - (vhdl-template-field "library name" "." nil nil nil nil + (let ((begin (point))) + (vhdl-template-field "library name" "." t begin (point) nil (vhdl-work-library)) (vhdl-template-field "entity name" "(") (if (vhdl-template-field "[architecture name]" nil t) (insert ")") - (delete-char -1))) + (delete-char -1)))) ((equal unit "CONFIGURATION") (vhdl-template-field "library name" "." nil nil nil nil (vhdl-work-library)) @@ -9845,7 +10079,7 @@ otherwise." (let ((definition (upcase (or (vhdl-template-field - "[scalar type | ARRAY | RECORD | ACCESS | FILE]" nil t) + "[scalar type | ARRAY | RECORD | ACCESS | FILE | ENUM]" nil t) "")))) (cond ((equal definition "") (delete-char -4) @@ -9863,6 +10097,11 @@ otherwise." ((equal definition "FILE") (vhdl-insert-keyword " OF ") (vhdl-template-field "type" ";")) + ((equal definition "ENUM") + (kill-word -1) + (insert "(") + (setq end-pos (point-marker)) + (insert ");")) (t (insert ";"))) (when mid-pos (setq end-pos (point-marker)) @@ -10909,7 +11148,7 @@ but not if inside a comment or quote." (backward-word 1) (vhdl-case-word 1) (delete-char 1)) - (let ((invoke-char last-command-event) + (let ((invoke-char vhdl-last-input-event) (abbrev-mode -1) (vhdl-template-invoked-by-hook t)) (let ((caught (catch 'abort @@ -11633,7 +11872,8 @@ reflected in a subsequent paste operation." ;; paste formal and actual generic (insert (car (nth 0 generic)) " => " (if no-constants - (car (nth 0 generic)) + (vhdl-replace-string vhdl-actual-generic-name + (car (nth 0 generic))) (or (nth 2 generic) ""))) (setq generic-list (cdr generic-list)) (insert (if generic-list "," ")")) @@ -11776,7 +12016,7 @@ reflected in a subsequent paste operation." ;; paste generic constants (setq name (nth 0 generic)) (when name - (insert (car name)) + (insert (vhdl-replace-string vhdl-actual-generic-name (car name))) ;; paste type (insert " : " (nth 1 generic)) ;; paste initialization @@ -11802,7 +12042,7 @@ reflected in a subsequent paste operation." (message "Pasting port as signals...") (unless no-indent (indent-according-to-mode)) (let ((margin (current-indentation)) - start port names + start port names type generic-list port-name constant-name pos (port-list (nth 2 vhdl-port-list))) (when port-list (setq start (point)) @@ -11822,7 +12062,21 @@ reflected in a subsequent paste operation." (setq names (cdr names)) (when names (insert ", "))) ;; paste type - (insert " : " (nth 3 port)) + (setq type (nth 3 port)) + (setq generic-list (nth 1 vhdl-port-list)) + (vhdl-prepare-search-1 + (setq pos 0) + ;; replace formal by actual generics + (while generic-list + (setq port-name (car (nth 0 (car generic-list)))) + (while (string-match (concat "\\<" port-name "\\>") type pos) + (setq constant-name + (save-match-data (vhdl-replace-string + vhdl-actual-generic-name port-name))) + (setq type (replace-match constant-name t nil type)) + (setq pos (match-end 0))) + (setq generic-list (cdr generic-list)))) + (insert " : " type) ;; paste initialization (inputs only) (when (and initialize (nth 2 port) (equal "IN" (upcase (nth 2 port)))) (insert " := " @@ -12410,77 +12664,6 @@ expressions (e.g. for index ranges of types and signals)." '(try-expand-list try-expand-list-all-buffers))) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Case fixing - -(defun vhdl-fix-case-region-1 (beg end upper-case word-regexp &optional count) - "Convert all words matching WORD-REGEXP in region to lower or upper case, -depending on parameter UPPER-CASE." - (let ((case-replace nil) - (last-update 0)) - (vhdl-prepare-search-2 - (save-excursion - (goto-char end) - (setq end (point-marker)) - (goto-char beg) - (while (re-search-forward word-regexp end t) - (or (vhdl-in-literal) - (if upper-case - (upcase-word -1) - (downcase-word -1))) - (when (and count vhdl-progress-interval (not noninteractive) - (< vhdl-progress-interval - (- (nth 1 (current-time)) last-update))) - (message "Fixing case... (%2d%s)" - (+ (* count 20) (/ (* 20 (- (point) beg)) (- end beg))) - "%") - (setq last-update (nth 1 (current-time))))) - (goto-char end))))) - -(defun vhdl-fix-case-region (beg end &optional arg) - "Convert all VHDL words in region to lower or upper case, depending on -options vhdl-upper-case-{keywords,types,attributes,enum-values}." - (interactive "r\nP") - (vhdl-fix-case-region-1 - beg end vhdl-upper-case-keywords vhdl-keywords-regexp 0) - (vhdl-fix-case-region-1 - beg end vhdl-upper-case-types vhdl-types-regexp 1) - (vhdl-fix-case-region-1 - beg end vhdl-upper-case-attributes (concat "'" vhdl-attributes-regexp) 2) - (vhdl-fix-case-region-1 - beg end vhdl-upper-case-enum-values vhdl-enum-values-regexp 3) - (vhdl-fix-case-region-1 - beg end vhdl-upper-case-constants vhdl-constants-regexp 4) - (when vhdl-progress-interval (message "Fixing case...done"))) - -(defun vhdl-fix-case-buffer () - "Convert all VHDL words in buffer to lower or upper case, depending on -options vhdl-upper-case-{keywords,types,attributes,enum-values}." - (interactive) - (vhdl-fix-case-region (point-min) (point-max))) - -(defun vhdl-fix-case-word (&optional arg) - "Convert word after cursor to upper case if necessary." - (interactive "p") - (save-excursion - (when arg (backward-word 1)) - (vhdl-prepare-search-1 - (when (and vhdl-upper-case-keywords - (looking-at vhdl-keywords-regexp)) - (upcase-word 1)) - (when (and vhdl-upper-case-types - (looking-at vhdl-types-regexp)) - (upcase-word 1)) - (when (and vhdl-upper-case-attributes - (looking-at vhdl-attributes-regexp)) - (upcase-word 1)) - (when (and vhdl-upper-case-enum-values - (looking-at vhdl-enum-values-regexp)) - (upcase-word 1)) - (when (and vhdl-upper-case-constants - (looking-at vhdl-constants-regexp)) - (upcase-word 1))))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Line handling functions @@ -12635,7 +12818,7 @@ it works within comments too." ;; print results (message "\n\ File statistics: \"%s\"\n\ ----------------------\n\ +-----------------------\n\ # statements : %5d\n\ # code lines : %5d\n\ # empty lines : %5d\n\ @@ -13486,9 +13669,9 @@ hierarchy otherwise.") (while (and (re-search-backward "^[ \t]*\\(end\\|use\\)\\>" nil t) (equal "USE" (upcase (match-string 1)))) (when (looking-at "^[ \t]*use[ \t\n\r\f]*\\(\\w+\\)\\.\\(\\w+\\)\\.\\w+") - (setq lib-alist (cons (cons (match-string-no-properties 1) + (push (cons (match-string-no-properties 1) (vhdl-match-string-downcase 2)) - lib-alist)))))) + lib-alist))))) lib-alist)) (defun vhdl-scan-directory-contents (name &optional project update num-string @@ -13534,7 +13717,7 @@ hierarchy otherwise.") file-tmp-list) (while file-list (unless (string-match file-exclude-regexp (car file-list)) - (setq file-tmp-list (cons (car file-list) file-tmp-list))) + (push (car file-list) file-tmp-list)) (setq file-list (cdr file-list))) (setq file-list (nreverse file-tmp-list)))) ;; do for all files @@ -13569,7 +13752,7 @@ hierarchy otherwise.") "Entity declared twice (used 1.): \"%s\"\n 1. in \"%s\" (line %d)\n 2. in \"%s\" (line %d)" ent-name (nth 1 ent-entry) (nth 2 ent-entry) file-name (vhdl-current-line)) - (setq ent-list (cons ent-key ent-list)) + (push ent-key ent-list) (aput 'ent-alist ent-key (list ent-name file-name (vhdl-current-line) (nth 3 ent-entry) (nth 4 ent-entry) @@ -13621,7 +13804,7 @@ hierarchy otherwise.") "Configuration declared twice (used 1.): \"%s\" of \"%s\"\n 1. in \"%s\" (line %d)\n 2. in \"%s\" (line %d)" conf-name ent-name (nth 1 conf-entry) (nth 2 conf-entry) file-name conf-line) - (setq conf-list (cons conf-key conf-list)) + (push conf-key conf-list) ;; scan for subconfigurations and subentities (while (re-search-forward "^[ \t]*for[ \t\n\r\f]+\\(\\w+\\([ \t\n\r\f]*,[ \t\n\r\f]*\\w+\\)*\\)[ \t\n\r\f]*:[ \t\n\r\f]*\\(\\w+\\)[ \t\n\r\f]+" end-of-unit t) (setq inst-comp-key (vhdl-match-string-downcase 3) @@ -13684,8 +13867,8 @@ hierarchy otherwise.") (setq func-alist (nreverse func-alist)) (setq comp-alist (nreverse comp-alist)) (if is-body - (setq pack-body-list (cons pack-key pack-body-list)) - (setq pack-list (cons pack-key pack-list))) + (push pack-key pack-body-list) + (push pack-key pack-list)) (aput 'pack-alist pack-key (if is-body @@ -13939,7 +14122,7 @@ of PROJECT." (let ((case-fold-search nil)) (while dir-list (unless (string-match file-exclude-regexp (car dir-list)) - (setq dir-list-tmp (cons (car dir-list) dir-list-tmp))) + (push (car dir-list) dir-list-tmp)) (setq dir-list (cdr dir-list))) (setq dir-list (nreverse dir-list-tmp)))) (message "Collecting source files...done") @@ -14331,7 +14514,7 @@ if required." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Add hierarchy browser functionality to speedbar -(defvar vhdl-speedbar-key-map nil +(defvar vhdl-speedbar-mode-map nil "Keymap used when in the VHDL hierarchy browser mode.") (defvar vhdl-speedbar-menu-items nil @@ -14359,24 +14542,24 @@ if required." (speedbar-item-info . vhdl-speedbar-item-info) (speedbar-line-directory . vhdl-speedbar-line-project))) ;; keymap - (unless vhdl-speedbar-key-map - (setq vhdl-speedbar-key-map (speedbar-make-specialized-keymap)) - (define-key vhdl-speedbar-key-map "e" 'speedbar-edit-line) - (define-key vhdl-speedbar-key-map "\C-m" 'speedbar-edit-line) - (define-key vhdl-speedbar-key-map "+" 'speedbar-expand-line) - (define-key vhdl-speedbar-key-map "=" 'speedbar-expand-line) - (define-key vhdl-speedbar-key-map "-" 'vhdl-speedbar-contract-level) - (define-key vhdl-speedbar-key-map "_" 'vhdl-speedbar-contract-all) - (define-key vhdl-speedbar-key-map "C" 'vhdl-speedbar-port-copy) - (define-key vhdl-speedbar-key-map "P" 'vhdl-speedbar-place-component) - (define-key vhdl-speedbar-key-map "F" 'vhdl-speedbar-configuration) - (define-key vhdl-speedbar-key-map "A" 'vhdl-speedbar-select-mra) - (define-key vhdl-speedbar-key-map "K" 'vhdl-speedbar-make-design) - (define-key vhdl-speedbar-key-map "R" 'vhdl-speedbar-rescan-hierarchy) - (define-key vhdl-speedbar-key-map "S" 'vhdl-save-caches) + (unless vhdl-speedbar-mode-map + (setq vhdl-speedbar-mode-map (speedbar-make-specialized-keymap)) + (define-key vhdl-speedbar-mode-map "e" 'speedbar-edit-line) + (define-key vhdl-speedbar-mode-map "\C-m" 'speedbar-edit-line) + (define-key vhdl-speedbar-mode-map "+" 'speedbar-expand-line) + (define-key vhdl-speedbar-mode-map "=" 'speedbar-expand-line) + (define-key vhdl-speedbar-mode-map "-" 'vhdl-speedbar-contract-level) + (define-key vhdl-speedbar-mode-map "_" 'vhdl-speedbar-contract-all) + (define-key vhdl-speedbar-mode-map "C" 'vhdl-speedbar-port-copy) + (define-key vhdl-speedbar-mode-map "P" 'vhdl-speedbar-place-component) + (define-key vhdl-speedbar-mode-map "F" 'vhdl-speedbar-configuration) + (define-key vhdl-speedbar-mode-map "A" 'vhdl-speedbar-select-mra) + (define-key vhdl-speedbar-mode-map "K" 'vhdl-speedbar-make-design) + (define-key vhdl-speedbar-mode-map "R" 'vhdl-speedbar-rescan-hierarchy) + (define-key vhdl-speedbar-mode-map "S" 'vhdl-save-caches) (let ((key 0)) (while (<= key 9) - (define-key vhdl-speedbar-key-map (int-to-string key) + (define-key vhdl-speedbar-mode-map (int-to-string key) `(lambda () (interactive) (vhdl-speedbar-set-depth ,key))) (setq key (1+ key))))) (define-key speedbar-mode-map "h" @@ -14429,10 +14612,10 @@ if required." ["Save Caches" vhdl-save-caches vhdl-updated-project-list]))) ;; hook-ups (speedbar-add-expansion-list - '("vhdl directory" vhdl-speedbar-menu-items vhdl-speedbar-key-map + '("vhdl directory" vhdl-speedbar-menu-items vhdl-speedbar-mode-map vhdl-speedbar-display-directory)) (speedbar-add-expansion-list - '("vhdl project" vhdl-speedbar-menu-items vhdl-speedbar-key-map + '("vhdl project" vhdl-speedbar-menu-items vhdl-speedbar-mode-map vhdl-speedbar-display-projects)) (setq speedbar-stealthy-function-list (append @@ -14719,15 +14902,15 @@ otherwise use cached data." (setq arch-alist (nth 4 (car ent-alist))) (setq subunit-alist nil) (while arch-alist - (setq subunit-alist (cons (caar arch-alist) subunit-alist)) + (push (caar arch-alist) subunit-alist) (setq arch-alist (cdr arch-alist))) - (setq unit-alist (cons (list (caar ent-alist) subunit-alist) unit-alist)) + (push (list (caar ent-alist) subunit-alist) unit-alist) (setq ent-alist (cdr ent-alist))) (while conf-alist - (setq unit-alist (cons (list (caar conf-alist)) unit-alist)) + (push (list (caar conf-alist)) unit-alist) (setq conf-alist (cdr conf-alist))) (while pack-alist - (setq unit-alist (cons (list (caar pack-alist)) unit-alist)) + (push (list (caar pack-alist)) unit-alist) (setq pack-alist (cdr pack-alist))) (aput 'vhdl-speedbar-shown-unit-alist key unit-alist) (vhdl-speedbar-refresh) @@ -15367,7 +15550,7 @@ NO-POSITION non-nil means do not re-position cursor." (concat (speedbar-line-directory indent) token)))) (while oldl (if (not (string-match (concat "^" (regexp-quote td)) (car oldl))) - (setq newl (cons (car oldl) newl))) + (push (car oldl) newl)) (setq oldl (cdr oldl))) (setq speedbar-shown-directories (nreverse newl))) (speedbar-change-expand-button-char ?+) @@ -15474,7 +15657,7 @@ NO-POSITION non-nil means do not re-position cursor." (setq dir (car path-list)) (string-match "\\(-r \\)?\\(\\([^?*]*[/\\]\\)*\\)" dir) (if (file-directory-p (match-string 2 dir)) - (setq path-list-1 (cons dir path-list-1)) + (push dir path-list-1) (vhdl-warning-when-idle "No such directory: \"%s\"" (match-string 2 dir))) (setq path-list (cdr path-list))) ;; resolve path wildcards @@ -15496,13 +15679,13 @@ NO-POSITION non-nil means do not re-position cursor." dir-list) (while all-list (when (file-directory-p (car all-list)) - (setq dir-list (cons (car all-list) dir-list))) + (push (car all-list) dir-list)) (setq all-list (cdr all-list))) dir-list)) (cdr path-list-1)))) (string-match "\\(-r \\)?\\(.*\\)[/\\].*" dir) (when (file-directory-p (match-string 2 dir)) - (setq path-list-2 (cons dir path-list-2))) + (push dir path-list-2)) (setq path-list-1 (cdr path-list-1)))) (nreverse path-list-2))) @@ -15527,8 +15710,7 @@ is already shown in a buffer." (let ((buffer (get-file-buffer (car token)))) (speedbar-find-file-in-frame (car token)) (when (or vhdl-speedbar-jump-to-unit buffer) - (goto-char (point-min)) - (forward-line (1- (cdr token))) + (vhdl-goto-line (cdr token)) (recenter)) (vhdl-speedbar-update-current-unit t t) (speedbar-set-timer dframe-update-speed) @@ -15546,8 +15728,7 @@ is already shown in a buffer." (let ((token (get-text-property (match-beginning 3) 'speedbar-token))) (vhdl-visit-file (car token) t - (progn (goto-char (point-min)) - (forward-line (1- (cdr token))) + (progn (vhdl-goto-line (cdr token)) (end-of-line) (if is-entity (vhdl-port-copy) @@ -16000,7 +16181,7 @@ component instantiation." (or (aget generic-alist (match-string 2) t) (error "ERROR: Formal generic \"%s\" mismatch for instance \"%s\"" (match-string 2) inst-name)) (cdar generic-alist)))) - (setq constant-alist (cons constant-entry constant-alist)) + (push constant-entry constant-alist) (setq constant-name (downcase constant-name)) (if (or (member constant-name single-list) (member constant-name multi-list)) @@ -16020,7 +16201,7 @@ component instantiation." (or (aget port-alist (match-string 2) t) (error "ERROR: Formal port \"%s\" mismatch for instance \"%s\"" (match-string 2) inst-name)) (cdar port-alist)))) - (setq signal-alist (cons signal-entry signal-alist)) + (push signal-entry signal-alist) (setq signal-name (downcase signal-name)) (if (equal (upcase (nth 2 signal-entry)) "IN") ;; input signal @@ -16054,8 +16235,8 @@ component instantiation." (unless (match-string 1) (setq port-alist (cdr port-alist))) (vhdl-forward-syntactic-ws)) - (setq inst-alist (cons (list inst-name (nreverse constant-alist) - (nreverse signal-alist)) inst-alist))) + (push (list inst-name (nreverse constant-alist) + (nreverse signal-alist)) inst-alist)) ;; prepare signal insertion (vhdl-goto-marker arch-decl-pos) (forward-line 1) @@ -16122,6 +16303,7 @@ component instantiation." (while constant-alist (setq constant-name (downcase (caar constant-alist)) constant-entry (car constant-alist)) + (unless (string-match "^[0-9]+" constant-name) (cond ((member constant-name written-list) nil) ((member constant-name multi-list) @@ -16138,7 +16320,7 @@ component instantiation." (setq generic-end-pos (vhdl-compose-insert-generic constant-entry)) (setq generic-inst-pos (point-marker)) - (add-to-list 'written-list constant-name))) + (add-to-list 'written-list constant-name)))) (setq constant-alist (cdr constant-alist))) (when (/= constant-temp-pos generic-inst-pos) (vhdl-goto-marker (vhdl-max-marker constant-temp-pos generic-pos)) @@ -16298,8 +16480,7 @@ current project/directory." ;; insert component declarations (while ent-alist (vhdl-visit-file (nth 2 (car ent-alist)) nil - (progn (goto-char (point-min)) - (forward-line (1- (nth 3 (car ent-alist)))) + (progn (vhdl-goto-line (nth 3 (car ent-alist))) (end-of-line) (vhdl-port-copy))) (goto-char component-pos) @@ -16555,12 +16736,12 @@ no project is defined." (setq sublist (nth 11 (car commands-alist))) (unless (or (equal "" (car sublist)) (assoc (car sublist) regexp-alist)) - (setq regexp-alist (cons (list (nth 0 sublist) - (if (= 0 (nth 1 sublist)) - (if (featurep 'xemacs) 9 nil) + (push (list (nth 0 sublist) + (if (and (featurep 'xemacs) (not (nth 1 sublist))) + 9 (nth 1 sublist)) (nth 2 sublist) (nth 3 sublist)) - regexp-alist))) + regexp-alist)) (setq commands-alist (cdr commands-alist))) (setq compilation-error-regexp-alist (append compilation-error-regexp-alist (nreverse regexp-alist)))) @@ -16573,7 +16754,7 @@ no project is defined." (setq sublist (nth 12 (car commands-alist))) (unless (or (equal "" (car sublist)) (assoc (car sublist) regexp-alist)) - (setq regexp-alist (cons sublist regexp-alist))) + (push sublist regexp-alist)) (setq commands-alist (cdr commands-alist))) (setq compilation-file-regexp-alist (append compilation-file-regexp-alist (nreverse regexp-alist)))))) @@ -16702,6 +16883,42 @@ specified by a target." (compile (concat (if (equal command "") "make" command) " " options " " vhdl-make-target)))) +;; Emacs 22+ setup +(defvar vhdl-error-regexp-emacs-alist + ;; Get regexps from `vhdl-compiler-alist' + (let ((compiler-alist vhdl-compiler-alist) + (error-regexp-alist '((vhdl-directory "^ *Compiling \"\\(.+\\)\"" 1)))) + (while compiler-alist + ;; add error message regexps + (setq error-regexp-alist + (cons (append (list (make-symbol (concat "vhdl-" (subst-char-in-string ? ?- (downcase (nth 0 (car compiler-alist))))))) + (nth 11 (car compiler-alist))) + error-regexp-alist)) + ;; add filename regexps + (when (/= 0 (nth 1 (nth 12 (car compiler-alist)))) + (setq error-regexp-alist + (cons (append (list (make-symbol (concat "vhdl-" (subst-char-in-string ? ?- (downcase (nth 0 (car compiler-alist)))) "-file"))) + (nth 12 (car compiler-alist))) + error-regexp-alist))) + (setq compiler-alist (cdr compiler-alist))) + error-regexp-alist) + "List of regexps for VHDL compilers. For Emacs 22+.") + +;; Add error regexps using compilation-mode-hook. +(defun vhdl-error-regexp-add-emacs () + "Set up Emacs compile for VHDL." + (interactive) + (when (and (boundp 'compilation-error-regexp-alist-alist) + (not (assoc 'vhdl-modelsim compilation-error-regexp-alist-alist))) + (mapcar + (lambda (item) + (push (car item) compilation-error-regexp-alist) + (push item compilation-error-regexp-alist-alist)) + vhdl-error-regexp-emacs-alist))) + +(when vhdl-emacs-22 + (add-hook 'compilation-mode-hook 'vhdl-error-regexp-add-emacs)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Makefile generation @@ -16724,7 +16941,7 @@ specified by a target." (let (pack-list) (while lib-alist (when (equal (downcase (caar lib-alist)) (downcase work-library)) - (setq pack-list (cons (cdar lib-alist) pack-list))) + (push (cdar lib-alist) pack-list)) (setq lib-alist (cdr lib-alist))) pack-list)) @@ -16776,8 +16993,10 @@ specified by a target." (setq ent-entry (car ent-alist) ent-key (nth 0 ent-entry)) (when (nth 2 ent-entry) - (setq ent-file-name (file-relative-name - (nth 2 ent-entry) compile-directory) + (setq ent-file-name (if vhdl-compile-absolute-path + (nth 2 ent-entry) + (file-relative-name (nth 2 ent-entry) + compile-directory)) arch-alist (nth 4 ent-entry) lib-alist (nth 6 ent-entry) rule (aget rule-alist ent-file-name) @@ -16787,9 +17006,9 @@ specified by a target." subcomp-list nil) (setq tmp-key (vhdl-replace-string ent-regexp (funcall adjust-case ent-key))) - (setq unit-list (cons (cons ent-key tmp-key) unit-list)) + (push (cons ent-key tmp-key) unit-list) ;; rule target for this entity - (setq target-list (cons ent-key target-list)) + (push ent-key target-list) ;; rule dependencies for all used packages (setq pack-list (vhdl-get-packages lib-alist work-library)) (setq depend-list (append depend-list pack-list)) @@ -16801,8 +17020,10 @@ specified by a target." (setq arch-entry (car arch-alist) arch-key (nth 0 arch-entry) ent-arch-key (concat ent-key "-" arch-key) - arch-file-name (file-relative-name (nth 2 arch-entry) - compile-directory) + arch-file-name (if vhdl-compile-absolute-path + (nth 2 arch-entry) + (file-relative-name (nth 2 arch-entry) + compile-directory)) inst-alist (nth 4 arch-entry) lib-alist (nth 5 arch-entry) rule (aget rule-alist arch-file-name) @@ -16813,11 +17034,11 @@ specified by a target." (funcall adjust-case (concat arch-key " " ent-key)))) (setq unit-list (cons (cons ent-arch-key tmp-key) unit-list)) - (setq second-list (cons ent-arch-key second-list)) + (push ent-arch-key second-list) ;; rule target for this architecture - (setq target-list (cons ent-arch-key target-list)) + (push ent-arch-key target-list) ;; rule dependency for corresponding entity - (setq depend-list (cons ent-key depend-list)) + (push ent-key depend-list) ;; rule dependencies for contained component instantiations (while inst-alist (setq inst-entry (car inst-alist)) @@ -16835,9 +17056,8 @@ specified by a target." ;; add rule (aput 'rule-alist arch-file-name (list target-list depend-list)) (setq arch-alist (cdr arch-alist))) - (setq prim-list (cons (list ent-key second-list - (append subcomp-list all-pack-list)) - prim-list))) + (push (list ent-key second-list (append subcomp-list all-pack-list)) + prim-list)) (setq ent-alist (cdr ent-alist))) (setq ent-alist tmp-list) ;; rules for all configurations @@ -16845,8 +17065,10 @@ specified by a target." (while conf-alist (setq conf-entry (car conf-alist) conf-key (nth 0 conf-entry) - conf-file-name (file-relative-name - (nth 2 conf-entry) compile-directory) + conf-file-name (if vhdl-compile-absolute-path + (nth 2 conf-entry) + (file-relative-name (nth 2 conf-entry) + compile-directory)) ent-key (nth 4 conf-entry) arch-key (nth 5 conf-entry) inst-alist (nth 6 conf-entry) @@ -16857,9 +17079,9 @@ specified by a target." subcomp-list (list ent-key)) (setq tmp-key (vhdl-replace-string conf-regexp (funcall adjust-case conf-key))) - (setq unit-list (cons (cons conf-key tmp-key) unit-list)) + (push (cons conf-key tmp-key) unit-list) ;; rule target for this configuration - (setq target-list (cons conf-key target-list)) + (push conf-key target-list) ;; rule dependency for corresponding entity and architecture (setq depend-list (cons ent-key (cons (concat ent-key "-" arch-key) depend-list))) @@ -16877,16 +17099,14 @@ specified by a target." (setq depend-list (cons inst-ent-key depend-list) subcomp-list (cons inst-ent-key subcomp-list))) ; (when comp-arch-key -; (setq depend-list (cons (concat comp-ent-key "-" comp-arch-key) -; depend-list))) +; (push (concat comp-ent-key "-" comp-arch-key) depend-list)) (when inst-conf-key (setq depend-list (cons inst-conf-key depend-list) subcomp-list (cons inst-conf-key subcomp-list)))) (setq inst-alist (cdr inst-alist))) ;; add rule (aput 'rule-alist conf-file-name (list target-list depend-list)) - (setq prim-list (cons (list conf-key nil (append subcomp-list pack-list)) - prim-list)) + (push (list conf-key nil (append subcomp-list pack-list)) prim-list) (setq conf-alist (cdr conf-alist))) (setq conf-alist tmp-list) ;; rules for all packages @@ -16896,16 +17116,18 @@ specified by a target." pack-key (nth 0 pack-entry) pack-body-key nil) (when (nth 2 pack-entry) - (setq pack-file-name (file-relative-name (nth 2 pack-entry) - compile-directory) + (setq pack-file-name (if vhdl-compile-absolute-path + (nth 2 pack-entry) + (file-relative-name (nth 2 pack-entry) + compile-directory)) lib-alist (nth 6 pack-entry) lib-body-alist (nth 10 pack-entry) rule (aget rule-alist pack-file-name) target-list (nth 0 rule) depend-list (nth 1 rule)) (setq tmp-key (vhdl-replace-string pack-regexp (funcall adjust-case pack-key))) - (setq unit-list (cons (cons pack-key tmp-key) unit-list)) + (push (cons pack-key tmp-key) unit-list) ;; rule target for this package - (setq target-list (cons pack-key target-list)) + (push pack-key target-list) ;; rule dependencies for all used packages (setq pack-list (vhdl-get-packages lib-alist work-library)) (setq depend-list (append depend-list pack-list)) @@ -16915,8 +17137,10 @@ specified by a target." ;; rules for this package's body (when (nth 7 pack-entry) (setq pack-body-key (concat pack-key "-body") - pack-body-file-name (file-relative-name (nth 7 pack-entry) - compile-directory) + pack-body-file-name (if vhdl-compile-absolute-path + (nth 7 pack-entry) + (file-relative-name (nth 7 pack-entry) + compile-directory)) rule (aget rule-alist pack-body-file-name) target-list (nth 0 rule) depend-list (nth 1 rule)) @@ -16925,9 +17149,9 @@ specified by a target." (setq unit-list (cons (cons pack-body-key tmp-key) unit-list)) ;; rule target for this package's body - (setq target-list (cons pack-body-key target-list)) + (push pack-body-key target-list) ;; rule dependency for corresponding package declaration - (setq depend-list (cons pack-key depend-list)) + (push pack-key depend-list) ;; rule dependencies for all used packages (setq pack-list (vhdl-get-packages lib-body-alist work-library)) (setq depend-list (append depend-list pack-list)) @@ -17050,16 +17274,16 @@ specified by a target." (unless (equal unit-key unit-name) (insert " \\\n" unit-name)) (insert " :" - " \\\n\t\t" (nth 2 vhdl-makefile-default-targets) - " \\\n\t\t$(UNIT-" work-library "-" unit-key ")") - (while second-list - (insert " \\\n\t\t$(UNIT-" work-library "-" (car second-list) ")") - (setq second-list (cdr second-list))) + " \\\n\t\t" (nth 2 vhdl-makefile-default-targets)) (while subcomp-list (when (and (assoc (car subcomp-list) unit-list) (not (equal unit-key (car subcomp-list)))) (insert " \\\n\t\t" (car subcomp-list))) (setq subcomp-list (cdr subcomp-list))) + (insert " \\\n\t\t$(UNIT-" work-library "-" unit-key ")") + (while second-list + (insert " \\\n\t\t$(UNIT-" work-library "-" (car second-list) ")") + (setq second-list (cdr second-list))) (insert "\n") (setq prim-list (cdr prim-list))) ;; insert rule for each library unit file @@ -17198,6 +17422,7 @@ specified by a target." 'vhdl-include-direction-comments 'vhdl-include-type-comments 'vhdl-include-group-comments + 'vhdl-actual-generic-name 'vhdl-actual-port-name 'vhdl-instance-name 'vhdl-testbench-entity-name @@ -17280,13 +17505,21 @@ specified by a target." (defconst vhdl-doc-release-notes nil "\ -Release Notes for VHDL Mode 3.33 +Release Notes for VHDL Mode 3.34 ================================ - - New Features - - User Options +- Added support for GNU Emacs 22/23/24: + - Compilation error parsing fixed for new `compile.el' package. + +- Port translation: Derive actual generic name from formal generic name. + +- New user options: + `vhdl-actual-generic-name': Specify how actual generic names are obtained. +Release Notes for VHDL Mode 3.33 +================================ + New Features ------------ -- cgit v1.2.3 From 2d4bf34b5b83b3728b2fb18a72536f3e14afcf34 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Thu, 16 May 2013 16:52:02 +0800 Subject: * progmodes/octave.el (octave-indent-defun): Mark obsolete. (octave-mode-menu, octave-mode-map): Remove its uses. --- lisp/ChangeLog | 5 +++++ lisp/progmodes/octave.el | 45 ++++++++++++++++++--------------------------- 2 files changed, 23 insertions(+), 27 deletions(-) (limited to 'lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bb9dc479e94..e6f56664a52 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-05-16 Leo Liu + + * progmodes/octave.el (octave-indent-defun): Mark obsolete. + (octave-mode-menu, octave-mode-map): Remove its uses. + 2013-05-16 Reto Zimmermann Sync with upstream vhdl mode v3.34.2. diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 49c9c30d313..ab2f570cccb 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -98,8 +98,6 @@ parenthetical grouping.") (let ((map (make-sparse-keymap))) (define-key map "\M-." 'octave-find-definition) (define-key map "\M-\C-j" 'octave-indent-new-comment-line) - ;; C-c C-q is also used by cc modes for similar command - (define-key map "\C-c\C-q" 'octave-indent-defun) (define-key map "\C-c\C-p" 'octave-previous-code-line) (define-key map "\C-c\C-n" 'octave-next-code-line) (define-key map "\C-c\C-a" 'octave-beginning-of-line) @@ -134,27 +132,26 @@ parenthetical grouping.") "Menu for Octave mode." '("Octave" ("Lines" - ["Previous Code Line" octave-previous-code-line t] - ["Next Code Line" octave-next-code-line t] - ["Begin of Continuation" octave-beginning-of-line t] - ["End of Continuation" octave-end-of-line t] - ["Split Line at Point" octave-indent-new-comment-line t]) + ["Previous Code Line" octave-previous-code-line t] + ["Next Code Line" octave-next-code-line t] + ["Begin of Continuation" octave-beginning-of-line t] + ["End of Continuation" octave-end-of-line t] + ["Split Line at Point" octave-indent-new-comment-line t]) ("Blocks" - ["Mark Block" octave-mark-block t] - ["Close Block" smie-close-block t]) + ["Mark Block" octave-mark-block t] + ["Close Block" smie-close-block t]) ("Functions" - ["Indent Function" octave-indent-defun t] - ["Insert Function" octave-insert-defun t] - ["Update function file comment" octave-update-function-file-comment t]) + ["Insert Function" octave-insert-defun t] + ["Update function file comment" octave-update-function-file-comment t]) "-" ("Debug" - ["Send Current Line" octave-send-line t] - ["Send Current Block" octave-send-block t] - ["Send Current Function" octave-send-defun t] - ["Send Region" octave-send-region t] - ["Show Process Buffer" octave-show-process-buffer t] - ["Hide Process Buffer" octave-hide-process-buffer t] - ["Kill Process" octave-kill-process t]) + ["Send Current Line" octave-send-line t] + ["Send Current Block" octave-send-block t] + ["Send Current Function" octave-send-defun t] + ["Send Region" octave-send-region t] + ["Show Process Buffer" octave-show-process-buffer t] + ["Hide Process Buffer" octave-hide-process-buffer t] + ["Kill Process" octave-kill-process t]) "-" ["Indent Line" indent-according-to-mode t] ["Complete Symbol" completion-at-point t] @@ -1111,14 +1108,8 @@ The new line is properly indented." (insert (concat " " octave-continuation-string)) (reindent-then-newline-and-indent)))) -(defun octave-indent-defun () - "Properly indent the Octave function which contains point." - (interactive) - (save-excursion - (mark-defun) - (message "Indenting function...") - (indent-region (point) (mark) nil)) - (message "Indenting function...done.")) +(define-obsolete-function-alias + 'octave-indent-defun 'prog-indent-sexp "24.4") ;;; Motion -- cgit v1.2.3