From 1d375dcb8311394cab75aad9b3a0360008c7e929 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 27 Apr 2008 09:47:14 +0000 Subject: [PATCH 1/6] *** empty log message *** --- lisp/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5aaac0a545d..bd10fdd9286 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-04-27 Michael Albinus + + * net/tramp.el (tramp-replace-environment-variables): New defun. + (tramp-file-name-handler): Use it. + 2008-04-25 Stefan Monnier * diff-mode.el (diff-hunk-header-re-unified): Allow elided line counts. From bc8dfbbd59cdf03d8df89cf041b4c4943c3664d5 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 27 Apr 2008 09:56:45 +0000 Subject: [PATCH 2/6] * net/tramp.el (tramp-replace-environment-variables): New defun. (tramp-file-name-handler): Use it. --- lisp/net/tramp.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index aaac6bfda88..98eb93aa208 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4375,6 +4375,16 @@ ARGS are the arguments OPERATION has been called with." (setq res (cdr elt)))) res))) +(defun tramp-replace-environment-variables (filename) + "Replace environment variables in FILENAME. +Return the string with the replaced variables." + (when (string-match "$\\w+" filename) + (setq filename + (replace-match + (substitute-in-file-name (match-string 0 filename)) + t nil filename))) + filename) + ;; Main function. ;;;###autoload (defun tramp-file-name-handler (operation &rest args) @@ -4383,7 +4393,9 @@ Falls back to normal file name handler if no tramp file name handler exists." ;; (setq edebug-trace t) ;; (edebug-trace "%s" (with-output-to-string (backtrace))) (save-match-data - (let* ((filename (apply 'tramp-file-name-for-operation operation args)) + (let* ((filename + (tramp-replace-environment-variables + (apply 'tramp-file-name-for-operation operation args))) (completion (tramp-completion-mode-p filename)) (foreign (tramp-find-foreign-file-name-handler filename))) (with-parsed-tramp-file-name filename nil From ce31e57251682ea8e0709424e7e653f112630f33 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 28 Apr 2008 03:22:23 +0000 Subject: [PATCH 3/6] *** empty log message *** --- lisp/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bd10fdd9286..80aeddee9ce 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2008-04-28 Nick Roberts + + * progmodes/gdb-ui.el (gdb-info-breakpoints-custom): Make breakpoint + icons work for assembler, i.e. FILE.s, FILE.S (not disassembly). + (gdb-goto-breakpoint): Likewise for visiting breakpoints. + (gdb-assembler-custom): Be careful not to match other addresses. + 2008-04-27 Michael Albinus * net/tramp.el (tramp-replace-environment-variables): New defun. From 841b19a0a0fbf59a64f69e809697bf492f5e923a Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 28 Apr 2008 03:24:43 +0000 Subject: [PATCH 4/6] (gdb-info-breakpoints-custom): Make breakpoint icons work for assembler, i.e. FILE.s, FILE.S (not disassembly). (gdb-goto-breakpoint): Likewise for visiting breakpoints. (gdb-assembler-custom): Be careful not to match other addresses. --- lisp/progmodes/gdb-ui.el | 69 ++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index eee8f00d770..508b0e67073 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -1927,38 +1927,37 @@ static char *magick[] = { '(face font-lock-type-face))) (let ((bl (point)) (el (line-end-position))) - (if (re-search-forward " in \\(.*\\) at\\s-+" el t) - (progn - (add-text-properties - (match-beginning 1) (match-end 1) - '(face font-lock-function-name-face)) - (looking-at "\\(\\S-+\\):\\([0-9]+\\)") - (let ((line (match-string 2)) - (file (match-string 1))) - (add-text-properties bl el - '(mouse-face highlight - help-echo "mouse-2, RET: visit breakpoint")) - (unless (file-exists-p file) - (setq file (cdr (assoc bptno gdb-location-alist)))) - (if (and file - (not (string-equal file "File not found"))) - (with-current-buffer - (find-file-noselect file 'nowarn) - (gdb-init-buffer) - ;; Only want one breakpoint icon at each - ;; location. - (save-excursion - (goto-line (string-to-number line)) - (gdb-put-breakpoint-icon (eq flag ?y) bptno))) - (gdb-enqueue-input - (list - (concat gdb-server-prefix "list " - (match-string-no-properties 1) ":1\n") - 'ignore)) - (gdb-enqueue-input - (list (concat gdb-server-prefix "info source\n") - `(lambda () (gdb-get-location - ,bptno ,line ,flag))))))) + (when (re-search-forward " in \\(.*\\) at" el t) + (add-text-properties + (match-beginning 1) (match-end 1) + '(face font-lock-function-name-face))) + (if (re-search-forward ".*\\s-+\\(\\S-+\\):\\([0-9]+\\)$") + (let ((line (match-string 2)) + (file (match-string 1))) + (add-text-properties bl el + '(mouse-face highlight + help-echo "mouse-2, RET: visit breakpoint")) + (unless (file-exists-p file) + (setq file (cdr (assoc bptno gdb-location-alist)))) + (if (and file + (not (string-equal file "File not found"))) + (with-current-buffer + (find-file-noselect file 'nowarn) + (gdb-init-buffer) + ;; Only want one breakpoint icon at each + ;; location. + (save-excursion + (goto-line (string-to-number line)) + (gdb-put-breakpoint-icon (eq flag ?y) bptno))) + (gdb-enqueue-input + (list + (concat gdb-server-prefix "list " + (match-string-no-properties 1) ":1\n") + 'ignore)) + (gdb-enqueue-input + (list (concat gdb-server-prefix "info source\n") + `(lambda () (gdb-get-location + ,bptno ,line ,flag))))))) (if (re-search-forward "<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" el t) @@ -2131,7 +2130,7 @@ static char *magick[] = { (if event (posn-set-point (event-end event))) (save-excursion (beginning-of-line 1) - (if (looking-at "\\([0-9]+\\.?[0-9]*\\) .+ in .+ at\\s-+\\(\\S-+\\):\\([0-9]+\\)") + (if (looking-at "\\([0-9]+\\.?[0-9]*\\) .*\\s-+\\(\\S-+\\):\\([0-9]+\\)$") (let ((bptno (match-string 1)) (file (match-string 2)) (line (match-string 3))) @@ -2148,7 +2147,7 @@ static char *magick[] = { (error "No location specified.")))) -;; Frames buffer. This displays a perpetually correct bactracktrace +;; Frames buffer. This displays a perpetually correct backtrace ;; (from the command `where'). ;; ;; Alas, if your stack is deep, it is costly. @@ -3337,7 +3336,7 @@ BUFFER nil or omitted means use the current buffer." (with-current-buffer buffer (save-excursion (goto-char (point-min)) - (if (search-forward address nil t) + (if (re-search-forward (concat "^0x0*" address) nil t) (gdb-put-breakpoint-icon (eq flag ?y) bptno))))))) (if (not (equal gdb-pc-address "main")) (with-current-buffer buffer From 05a27ce5ccda276939037119ce2616053eaf5d7a Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 28 Apr 2008 07:18:03 +0000 Subject: [PATCH 5/6] (gdb-info-breakpoints-custom): Fix mismatched parentheses. --- lisp/progmodes/gdb-ui.el | 116 +++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 508b0e67073..ef9ce2d7e73 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -1911,66 +1911,66 @@ static char *magick[] = { (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) (save-excursion (let ((buffer-read-only nil)) - (goto-char (point-min)) - (while (< (point) (- (point-max) 1)) - (forward-line 1) - (if (looking-at gdb-breakpoint-regexp) - (progn - (setq bptno (or (match-string 1) (match-string 2))) - (setq flag (char-after (match-beginning 3))) - (if (match-string 1) - (setq gdb-parent-bptno-enabled (eq flag ?y))) - (add-text-properties - (match-beginning 3) (match-end 3) - (if (eq flag ?y) - '(face font-lock-warning-face) - '(face font-lock-type-face))) - (let ((bl (point)) - (el (line-end-position))) - (when (re-search-forward " in \\(.*\\) at" el t) - (add-text-properties - (match-beginning 1) (match-end 1) - '(face font-lock-function-name-face))) - (if (re-search-forward ".*\\s-+\\(\\S-+\\):\\([0-9]+\\)$") - (let ((line (match-string 2)) - (file (match-string 1))) - (add-text-properties bl el - '(mouse-face highlight - help-echo "mouse-2, RET: visit breakpoint")) - (unless (file-exists-p file) - (setq file (cdr (assoc bptno gdb-location-alist)))) - (if (and file - (not (string-equal file "File not found"))) - (with-current-buffer - (find-file-noselect file 'nowarn) - (gdb-init-buffer) - ;; Only want one breakpoint icon at each - ;; location. - (save-excursion - (goto-line (string-to-number line)) - (gdb-put-breakpoint-icon (eq flag ?y) bptno))) - (gdb-enqueue-input - (list - (concat gdb-server-prefix "list " - (match-string-no-properties 1) ":1\n") - 'ignore)) - (gdb-enqueue-input - (list (concat gdb-server-prefix "info source\n") - `(lambda () (gdb-get-location - ,bptno ,line ,flag))))))) - (if (re-search-forward - "<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" - el t) - (add-text-properties - (match-beginning 1) (match-end 1) - '(face font-lock-function-name-face)) - (end-of-line) - (re-search-backward "\\s-\\(\\S-*\\)" - bl t) + (goto-char (point-min)) + (while (< (point) (- (point-max) 1)) + (forward-line 1) + (if (looking-at gdb-breakpoint-regexp) + (progn + (setq bptno (or (match-string 1) (match-string 2))) + (setq flag (char-after (match-beginning 3))) + (if (match-string 1) + (setq gdb-parent-bptno-enabled (eq flag ?y))) + (add-text-properties + (match-beginning 3) (match-end 3) + (if (eq flag ?y) + '(face font-lock-warning-face) + '(face font-lock-type-face))) + (let ((bl (point)) + (el (line-end-position))) + (when (re-search-forward " in \\(.*\\) at" el t) (add-text-properties (match-beginning 1) (match-end 1) - '(face font-lock-variable-name-face))))))) - (end-of-line)))))) + '(face font-lock-function-name-face))) + (if (re-search-forward ".*\\s-+\\(\\S-+\\):\\([0-9]+\\)$") + (let ((line (match-string 2)) + (file (match-string 1))) + (add-text-properties bl el + '(mouse-face highlight + help-echo "mouse-2, RET: visit breakpoint")) + (unless (file-exists-p file) + (setq file (cdr (assoc bptno gdb-location-alist)))) + (if (and file + (not (string-equal file "File not found"))) + (with-current-buffer + (find-file-noselect file 'nowarn) + (gdb-init-buffer) + ;; Only want one breakpoint icon at each + ;; location. + (save-excursion + (goto-line (string-to-number line)) + (gdb-put-breakpoint-icon (eq flag ?y) bptno))) + (gdb-enqueue-input + (list + (concat gdb-server-prefix "list " + (match-string-no-properties 1) ":1\n") + 'ignore)) + (gdb-enqueue-input + (list (concat gdb-server-prefix "info source\n") + `(lambda () (gdb-get-location + ,bptno ,line ,flag)))))) + (if (re-search-forward + "<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" + el t) + (add-text-properties + (match-beginning 1) (match-end 1) + '(face font-lock-function-name-face)) + (end-of-line) + (re-search-backward "\\s-\\(\\S-*\\)" + bl t) + (add-text-properties + (match-beginning 1) (match-end 1) + '(face font-lock-variable-name-face))))))) + (end-of-line)))))) (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) (defun gdb-mouse-set-clear-breakpoint (event) From 76f31f76830a8ffe78cf86187ba2bf9cbae0f61c Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 28 Apr 2008 19:32:41 +0000 Subject: [PATCH 6/6] * net/tramp.el (tramp-replace-environment-variables): Remove it. There is a more simple solution. (tramp-file-name-handler): Apply `substitute-in-file-name' w/o Tramp file name handlers. --- lisp/ChangeLog | 7 +++++++ lisp/net/tramp.el | 15 +++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 80aeddee9ce..673c28f021b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2008-04-28 Michael Albinus + + * net/tramp.el (tramp-replace-environment-variables): Remove it. + There is a more simple solution. + (tramp-file-name-handler): Apply `substitute-in-file-name' w/o + Tramp file name handlers. + 2008-04-28 Nick Roberts * progmodes/gdb-ui.el (gdb-info-breakpoints-custom): Make breakpoint diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 98eb93aa208..5b2c9525b25 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4375,16 +4375,6 @@ ARGS are the arguments OPERATION has been called with." (setq res (cdr elt)))) res))) -(defun tramp-replace-environment-variables (filename) - "Replace environment variables in FILENAME. -Return the string with the replaced variables." - (when (string-match "$\\w+" filename) - (setq filename - (replace-match - (substitute-in-file-name (match-string 0 filename)) - t nil filename))) - filename) - ;; Main function. ;;;###autoload (defun tramp-file-name-handler (operation &rest args) @@ -4394,8 +4384,9 @@ Falls back to normal file name handler if no tramp file name handler exists." ;; (edebug-trace "%s" (with-output-to-string (backtrace))) (save-match-data (let* ((filename - (tramp-replace-environment-variables - (apply 'tramp-file-name-for-operation operation args))) + (tramp-run-real-handler + 'substitute-in-file-name + (list (apply 'tramp-file-name-for-operation operation args)))) (completion (tramp-completion-mode-p filename)) (foreign (tramp-find-foreign-file-name-handler filename))) (with-parsed-tramp-file-name filename nil