aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorStefan Monnier2011-03-21 12:42:16 -0400
committerStefan Monnier2011-03-21 12:42:16 -0400
commitcafdcef32d55cbb44389d7e322e7f973cbb72dfd (patch)
tree7ee0c41ea8a589650ce6f4311fb10e61a63807b9 /lisp/progmodes
parenta08a25d7aaf251aa18f2ef747be53734bc55cae9 (diff)
parent4e05e67e4cd0bc1b0a4ef3176a4d0d91c6b3738e (diff)
downloademacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.tar.gz
emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.zip
Merge from trunk
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/cc-cmds.el19
-rw-r--r--lisp/progmodes/compile.el49
-rw-r--r--lisp/progmodes/delphi.el75
-rw-r--r--lisp/progmodes/ebrowse.el12
-rw-r--r--lisp/progmodes/gdb-mi.el45
-rw-r--r--lisp/progmodes/gud.el4
-rw-r--r--lisp/progmodes/ruby-mode.el2
7 files changed, 110 insertions, 96 deletions
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 5ac30bc28ce..0f873e678c3 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -2564,19 +2564,12 @@ be more \"DWIM:ey\"."
2564 ;; Are we about to move backwards into or out of a 2564 ;; Are we about to move backwards into or out of a
2565 ;; preprocessor command? If so, locate its beginning. 2565 ;; preprocessor command? If so, locate its beginning.
2566 (when (eq (cdr res) 'macro-boundary) 2566 (when (eq (cdr res) 'macro-boundary)
2567 (setq macro-fence 2567 (save-excursion
2568 (save-excursion 2568 (beginning-of-line)
2569 (if macro-fence 2569 (setq macro-fence
2570 (progn 2570 (and (not (bobp))
2571 (end-of-line) 2571 (progn (c-skip-ws-backward) (c-beginning-of-macro))
2572 (and (not (eobp)) 2572 (point)))))
2573 (progn (c-skip-ws-forward)
2574 (c-beginning-of-macro))
2575 (progn (c-end-of-macro)
2576 (point))))
2577 (and (not (eobp))
2578 (c-beginning-of-macro)
2579 (progn (c-end-of-macro) (point)))))))
2580 ;; Are we about to move backwards into a literal? 2573 ;; Are we about to move backwards into a literal?
2581 (when (memq (cdr res) '(macro-boundary literal)) 2574 (when (memq (cdr res) '(macro-boundary literal))
2582 (setq range (c-ascertain-preceding-literal))) 2575 (setq range (c-ascertain-preceding-literal)))
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 88f418f934a..40383c6bc31 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -860,27 +860,29 @@ POS and RES.")
860 (car compilation--previous-directory-cache))) 860 (car compilation--previous-directory-cache)))
861 (prev 861 (prev
862 (previous-single-property-change 862 (previous-single-property-change
863 pos 'compilation-directory nil cache))) 863 pos 'compilation-directory nil cache))
864 (cond 864 (res
865 ((null cache) 865 (cond
866 (setq compilation--previous-directory-cache 866 ((null cache)
867 (cons (copy-marker pos) (copy-marker prev))) 867 (setq compilation--previous-directory-cache
868 prev) 868 (cons (copy-marker pos) (if prev (copy-marker prev))))
869 ((eq prev cache) 869 prev)
870 (if cache 870 ((and prev (= prev cache))
871 (set-marker (car compilation--previous-directory-cache) pos) 871 (if cache
872 (setq compilation--previous-directory-cache 872 (set-marker (car compilation--previous-directory-cache) pos)
873 (cons (copy-marker pos) nil))) 873 (setq compilation--previous-directory-cache
874 (cdr compilation--previous-directory-cache)) 874 (cons (copy-marker pos) nil)))
875 (t 875 (cdr compilation--previous-directory-cache))
876 (if cache 876 (t
877 (progn 877 (if cache
878 (set-marker (car compilation--previous-directory-cache) pos) 878 (progn
879 (setcdr compilation--previous-directory-cache 879 (set-marker cache pos)
880 (copy-marker prev))) 880 (setcdr compilation--previous-directory-cache
881 (setq compilation--previous-directory-cache 881 (copy-marker prev)))
882 (cons (copy-marker pos) (copy-marker prev)))) 882 (setq compilation--previous-directory-cache
883 prev))))) 883 (cons (copy-marker pos) (if prev (copy-marker prev)))))
884 prev))))
885 (if (markerp res) (marker-position res) res))))
884 886
885;; Internal function for calculating the text properties of a directory 887;; Internal function for calculating the text properties of a directory
886;; change message. The compilation-directory property is important, because it 888;; change message. The compilation-directory property is important, because it
@@ -889,7 +891,7 @@ POS and RES.")
889(defun compilation-directory-properties (idx leave) 891(defun compilation-directory-properties (idx leave)
890 (if leave (setq leave (match-end leave))) 892 (if leave (setq leave (match-end leave)))
891 ;; find previous stack, and push onto it, or if `leave' pop it 893 ;; find previous stack, and push onto it, or if `leave' pop it
892 (let ((dir (compilation--previous-directory (point)))) 894 (let ((dir (compilation--previous-directory (match-beginning 0))))
893 (setq dir (if dir (or (get-text-property (1- dir) 'compilation-directory) 895 (setq dir (if dir (or (get-text-property (1- dir) 'compilation-directory)
894 (get-text-property dir 'compilation-directory)))) 896 (get-text-property dir 'compilation-directory))))
895 `(font-lock-face ,(if leave 897 `(font-lock-face ,(if leave
@@ -948,7 +950,8 @@ POS and RES.")
948 (match-string-no-properties file)))) 950 (match-string-no-properties file))))
949 (let ((dir 951 (let ((dir
950 (unless (file-name-absolute-p file) 952 (unless (file-name-absolute-p file)
951 (let ((pos (compilation--previous-directory (point)))) 953 (let ((pos (compilation--previous-directory
954 (match-beginning 0))))
952 (when pos 955 (when pos
953 (or (get-text-property (1- pos) 'compilation-directory) 956 (or (get-text-property (1- pos) 'compilation-directory)
954 (get-text-property pos 'compilation-directory))))))) 957 (get-text-property pos 'compilation-directory)))))))
diff --git a/lisp/progmodes/delphi.el b/lisp/progmodes/delphi.el
index c376b25fae0..0f823c806e0 100644
--- a/lisp/progmodes/delphi.el
+++ b/lisp/progmodes/delphi.el
@@ -26,14 +26,14 @@
26 26
27;; To enter Delphi mode when you find a Delphi source file, one must override 27;; To enter Delphi mode when you find a Delphi source file, one must override
28;; the auto-mode-alist to associate Delphi with .pas (and .dpr and .dpk) 28;; the auto-mode-alist to associate Delphi with .pas (and .dpr and .dpk)
29;; files. Emacs, by default, will otherwise enter Pascal mode. E.g. 29;; files. Emacs, by default, will otherwise enter Pascal mode. E.g.
30;; 30;;
31;; (autoload 'delphi-mode "delphi") 31;; (autoload 'delphi-mode "delphi")
32;; (setq auto-mode-alist 32;; (setq auto-mode-alist
33;; (cons '("\\.\\(pas\\|dpr\\|dpk\\)$" . delphi-mode) auto-mode-alist)) 33;; (cons '("\\.\\(pas\\|dpr\\|dpk\\)$" . delphi-mode) auto-mode-alist))
34 34
35;; To get keyword, comment, and string literal coloring, be sure that font-lock 35;; To get keyword, comment, and string literal coloring, be sure that font-lock
36;; is running. One can manually do M-x font-lock-mode in a Delphi buffer, or 36;; is running. One can manually do M-x font-lock-mode in a Delphi buffer, or
37;; one can put in .emacs: 37;; one can put in .emacs:
38;; 38;;
39;; (add-hook 'delphi-mode-hook 'turn-on-font-lock) 39;; (add-hook 'delphi-mode-hook 'turn-on-font-lock)
@@ -56,8 +56,8 @@
56;; When you have entered Delphi mode, you may get more info by pressing 56;; When you have entered Delphi mode, you may get more info by pressing
57;; C-h m. 57;; C-h m.
58 58
59;; This delphi mode implementation is fairly tolerant of syntax errors, relying 59;; This Delphi mode implementation is fairly tolerant of syntax errors, relying
60;; as much as possible on the indentation of the previous statement. This also 60;; as much as possible on the indentation of the previous statement. This also
61;; makes it faster and simpler, since there is less searching for properly 61;; makes it faster and simpler, since there is less searching for properly
62;; constructed beginnings. 62;; constructed beginnings.
63 63
@@ -74,15 +74,16 @@
74 "True if in debug mode.") 74 "True if in debug mode.")
75 75
76(defcustom delphi-search-path "." 76(defcustom delphi-search-path "."
77 "*Directories to search when finding external units. It is a list of 77 "*Directories to search when finding external units.
78directory strings. If only a single directory, it can be a single 78It is a list of directory strings. If only a single directory,
79string instead of a list. If a directory ends in \"...\" then that 79it can be a single string instead of a list. If a directory
80directory is recursively searched." 80ends in \"...\" then that directory is recursively searched."
81 :type 'string 81 :type 'string
82 :group 'delphi) 82 :group 'delphi)
83 83
84(defcustom delphi-indent-level 3 84(defcustom delphi-indent-level 3
85 "*Indentation of Delphi statements with respect to containing block. E.g. 85 "*Indentation of Delphi statements with respect to containing block.
86E.g.
86 87
87begin 88begin
88 // This is an indent of 3. 89 // This is an indent of 3.
@@ -117,7 +118,7 @@ end; end;"
117 :group 'delphi) 118 :group 'delphi)
118 119
119(defcustom delphi-verbose t ; nil 120(defcustom delphi-verbose t ; nil
120 "*If true then delphi token processing progress is reported to the user." 121 "*If true then Delphi token processing progress is reported to the user."
121 :type 'boolean 122 :type 'boolean
122 :group 'delphi) 123 :group 'delphi)
123 124
@@ -137,17 +138,17 @@ differs from the default."
137 :group 'delphi) 138 :group 'delphi)
138 139
139(defcustom delphi-comment-face 'font-lock-comment-face 140(defcustom delphi-comment-face 'font-lock-comment-face
140 "*Face used to color delphi comments." 141 "*Face used to color Delphi comments."
141 :type 'face 142 :type 'face
142 :group 'delphi) 143 :group 'delphi)
143 144
144(defcustom delphi-string-face 'font-lock-string-face 145(defcustom delphi-string-face 'font-lock-string-face
145 "*Face used to color delphi strings." 146 "*Face used to color Delphi strings."
146 :type 'face 147 :type 'face
147 :group 'delphi) 148 :group 'delphi)
148 149
149(defcustom delphi-keyword-face 'font-lock-keyword-face 150(defcustom delphi-keyword-face 'font-lock-keyword-face
150 "*Face used to color delphi keywords." 151 "*Face used to color Delphi keywords."
151 :type 'face 152 :type 'face
152 :group 'delphi) 153 :group 'delphi)
153 154
@@ -720,9 +721,9 @@ routine.")
720 (delphi-progress-done))))) 721 (delphi-progress-done)))))
721 722
722(defvar delphi-ignore-changes t 723(defvar delphi-ignore-changes t
723 "Internal flag to control if the delphi-mode responds to buffer changes. 724 "Internal flag to control if the Delphi mode responds to buffer changes.
724Defaults to t in case the delphi-after-change function is called on a 725Defaults to t in case the `delphi-after-change' function is called on a
725non-delphi buffer. Set to nil in a delphi buffer. To override, just do: 726non-Delphi buffer. Set to nil in a Delphi buffer. To override, just do:
726 (let ((delphi-ignore-changes t)) ...)") 727 (let ((delphi-ignore-changes t)) ...)")
727 728
728(defun delphi-after-change (change-start change-end old-length) 729(defun delphi-after-change (change-start change-end old-length)
@@ -1521,8 +1522,8 @@ non-delphi buffer. Set to nil in a delphi buffer. To override, just do:
1521 indent))) 1522 indent)))
1522 1523
1523(defun delphi-indent-line () 1524(defun delphi-indent-line ()
1524 "Indent the current line according to the current language construct. If 1525 "Indent the current line according to the current language construct.
1525before the indent, the point is moved to the indent." 1526If before the indent, the point is moved to the indent."
1526 (interactive) 1527 (interactive)
1527 (delphi-save-match-data 1528 (delphi-save-match-data
1528 (let ((marked-point (point-marker)) ; Maintain our position reliably. 1529 (let ((marked-point (point-marker)) ; Maintain our position reliably.
@@ -1547,7 +1548,7 @@ before the indent, the point is moved to the indent."
1547 (set-marker marked-point nil)))) 1548 (set-marker marked-point nil))))
1548 1549
1549(defvar delphi-mode-abbrev-table nil 1550(defvar delphi-mode-abbrev-table nil
1550 "Abbrev table in use in delphi-mode buffers.") 1551 "Abbrev table in use in Delphi mode buffers.")
1551(define-abbrev-table 'delphi-mode-abbrev-table ()) 1552(define-abbrev-table 'delphi-mode-abbrev-table ())
1552 1553
1553(defmacro delphi-ensure-buffer (buffer-var buffer-name) 1554(defmacro delphi-ensure-buffer (buffer-var buffer-name)
@@ -1568,7 +1569,7 @@ before the indent, the point is moved to the indent."
1568;; Debugging helpers: 1569;; Debugging helpers:
1569 1570
1570(defvar delphi-debug-buffer nil 1571(defvar delphi-debug-buffer nil
1571 "Buffer to write delphi-mode debug messages to. Created on demand.") 1572 "Buffer to write Delphi mode debug messages to. Created on demand.")
1572 1573
1573(defun delphi-debug-log (format-string &rest args) 1574(defun delphi-debug-log (format-string &rest args)
1574 ;; Writes a message to the log buffer. 1575 ;; Writes a message to the log buffer.
@@ -1679,7 +1680,7 @@ before the indent, the point is moved to the indent."
1679 1680
1680(defun delphi-tab () 1681(defun delphi-tab ()
1681 "Indent the region, when Transient Mark mode is enabled and the region is 1682 "Indent the region, when Transient Mark mode is enabled and the region is
1682active. Otherwise, indent the current line or insert a TAB, depending on the 1683active. Otherwise, indent the current line or insert a TAB, depending on the
1683value of `delphi-tab-always-indents' and the current line position." 1684value of `delphi-tab-always-indents' and the current line position."
1684 (interactive) 1685 (interactive)
1685 (cond ((use-region-p) 1686 (cond ((use-region-p)
@@ -1768,8 +1769,8 @@ value of `delphi-tab-always-indents' and the current line position."
1768 nil)) 1769 nil))
1769 1770
1770(defun delphi-find-unit (unit) 1771(defun delphi-find-unit (unit)
1771 "Finds the specified delphi source file according to `delphi-search-path'. 1772 "Find the specified Delphi source file according to `delphi-search-path'.
1772If no extension is specified, .pas is assumed. Creates a buffer for the unit." 1773If no extension is specified, .pas is assumed. Creates a buffer for the unit."
1773 (interactive "sDelphi unit name: ") 1774 (interactive "sDelphi unit name: ")
1774 (let* ((unit-file (if (string-match "^\\(.*\\)\\.[a-z]+$" unit) 1775 (let* ((unit-file (if (string-match "^\\(.*\\)\\.[a-z]+$" unit)
1775 unit 1776 unit
@@ -1791,7 +1792,7 @@ If no extension is specified, .pas is assumed. Creates a buffer for the unit."
1791 "Find the definition of the identifier under the current point, searching 1792 "Find the definition of the identifier under the current point, searching
1792in external units if necessary (as listed in the current unit's use clause). 1793in external units if necessary (as listed in the current unit's use clause).
1793The set of directories to search for a unit is specified by the global variable 1794The set of directories to search for a unit is specified by the global variable
1794delphi-search-path." 1795`delphi-search-path'."
1795 (interactive) 1796 (interactive)
1796 (error "delphi-find-current-xdef: not implemented yet")) 1797 (error "delphi-find-current-xdef: not implemented yet"))
1797 1798
@@ -1802,7 +1803,7 @@ it is a routine."
1802 (error "delphi-find-current-body: not implemented yet")) 1803 (error "delphi-find-current-body: not implemented yet"))
1803 1804
1804(defun delphi-fill-comment () 1805(defun delphi-fill-comment ()
1805 "Fills the text of the current comment, according to `fill-column'. 1806 "Fill the text of the current comment, according to `fill-column'.
1806An error is raised if not in a comment." 1807An error is raised if not in a comment."
1807 (interactive) 1808 (interactive)
1808 (save-excursion 1809 (save-excursion
@@ -1888,8 +1889,8 @@ An error is raised if not in a comment."
1888 (delphi-progress-done))))))) 1889 (delphi-progress-done)))))))
1889 1890
1890(defun delphi-new-comment-line () 1891(defun delphi-new-comment-line ()
1891 "If in a // comment, does a newline, indented such that one is still in the 1892 "If in a // comment, do a newline, indented such that one is still in the
1892comment block. If not in a // comment, just does a normal newline." 1893comment block. If not in a // comment, just does a normal newline."
1893 (interactive) 1894 (interactive)
1894 (let ((comment (delphi-current-token))) 1895 (let ((comment (delphi-current-token)))
1895 (if (not (eq 'comment-single-line (delphi-token-kind comment))) 1896 (if (not (eq 'comment-single-line (delphi-token-kind comment)))
@@ -1923,7 +1924,7 @@ comment block. If not in a // comment, just does a normal newline."
1923 nil ; Syntax begin movement doesn't apply 1924 nil ; Syntax begin movement doesn't apply
1924 (font-lock-fontify-region-function . delphi-fontify-region) 1925 (font-lock-fontify-region-function . delphi-fontify-region)
1925 (font-lock-verbose . delphi-fontifying-progress-step)) 1926 (font-lock-verbose . delphi-fontifying-progress-step))
1926 "Delphi mode font-lock defaults. Syntactic fontification is ignored.") 1927 "Delphi mode font-lock defaults. Syntactic fontification is ignored.")
1927 1928
1928(defvar delphi-debug-mode-map 1929(defvar delphi-debug-mode-map
1929 (let ((kmap (make-sparse-keymap))) 1930 (let ((kmap (make-sparse-keymap)))
@@ -1944,7 +1945,7 @@ comment block. If not in a // comment, just does a normal newline."
1944 ("x" delphi-debug-show-is-stable) 1945 ("x" delphi-debug-show-is-stable)
1945 )) 1946 ))
1946 kmap) 1947 kmap)
1947 "Keystrokes for delphi-mode debug commands.") 1948 "Keystrokes for Delphi mode debug commands.")
1948 1949
1949(defvar delphi-mode-map 1950(defvar delphi-mode-map
1950 (let ((kmap (make-sparse-keymap))) 1951 (let ((kmap (make-sparse-keymap)))
@@ -1964,7 +1965,7 @@ comment block. If not in a // comment, just does a normal newline."
1964 "Keymap used in Delphi mode.") 1965 "Keymap used in Delphi mode.")
1965 1966
1966(defconst delphi-mode-syntax-table (make-syntax-table) 1967(defconst delphi-mode-syntax-table (make-syntax-table)
1967 "Delphi mode's syntax table. It is just a standard syntax table. 1968 "Delphi mode's syntax table. It is just a standard syntax table.
1968This is ok since we do our own keyword/comment/string face coloring.") 1969This is ok since we do our own keyword/comment/string face coloring.")
1969 1970
1970;;;###autoload 1971;;;###autoload
@@ -1976,7 +1977,7 @@ This is ok since we do our own keyword/comment/string face coloring.")
1976\\[delphi-fill-comment]\t- Fill the current comment. 1977\\[delphi-fill-comment]\t- Fill the current comment.
1977\\[delphi-new-comment-line]\t- If in a // comment, do a new comment line. 1978\\[delphi-new-comment-line]\t- If in a // comment, do a new comment line.
1978 1979
1979M-x indent-region also works for indenting a whole region. 1980\\[indent-region] also works for indenting a whole region.
1980 1981
1981Customization: 1982Customization:
1982 1983
@@ -1996,21 +1997,21 @@ Customization:
1996 `delphi-search-path' (default .) 1997 `delphi-search-path' (default .)
1997 Directories to search when finding external units. 1998 Directories to search when finding external units.
1998 `delphi-verbose' (default nil) 1999 `delphi-verbose' (default nil)
1999 If true then delphi token processing progress is reported to the user. 2000 If true then Delphi token processing progress is reported to the user.
2000 2001
2001Coloring: 2002Coloring:
2002 2003
2003 `delphi-comment-face' (default font-lock-comment-face) 2004 `delphi-comment-face' (default font-lock-comment-face)
2004 Face used to color delphi comments. 2005 Face used to color Delphi comments.
2005 `delphi-string-face' (default font-lock-string-face) 2006 `delphi-string-face' (default font-lock-string-face)
2006 Face used to color delphi strings. 2007 Face used to color Delphi strings.
2007 `delphi-keyword-face' (default font-lock-keyword-face) 2008 `delphi-keyword-face' (default font-lock-keyword-face)
2008 Face used to color delphi keywords. 2009 Face used to color Delphi keywords.
2009 `delphi-other-face' (default nil) 2010 `delphi-other-face' (default nil)
2010 Face used to color everything else. 2011 Face used to color everything else.
2011 2012
2012Turning on Delphi mode calls the value of the variable delphi-mode-hook with 2013Turning on Delphi mode calls the value of the variable `delphi-mode-hook'
2013no args, if that value is non-nil." 2014with no args, if that value is non-nil."
2014 (interactive) 2015 (interactive)
2015 (kill-all-local-variables) 2016 (kill-all-local-variables)
2016 (use-local-map delphi-mode-map) 2017 (use-local-map delphi-mode-map)
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el
index d674484345a..87e5875c943 100644
--- a/lisp/progmodes/ebrowse.el
+++ b/lisp/progmodes/ebrowse.el
@@ -3566,12 +3566,12 @@ KIND is an additional string printed in the buffer."
3566 (insert kind) 3566 (insert kind)
3567 (indent-to 50) 3567 (indent-to 50)
3568 (insert (case (second info) 3568 (insert (case (second info)
3569 ('ebrowse-ts-member-functions "member function") 3569 (ebrowse-ts-member-functions "member function")
3570 ('ebrowse-ts-member-variables "member variable") 3570 (ebrowse-ts-member-variables "member variable")
3571 ('ebrowse-ts-static-functions "static function") 3571 (ebrowse-ts-static-functions "static function")
3572 ('ebrowse-ts-static-variables "static variable") 3572 (ebrowse-ts-static-variables "static variable")
3573 ('ebrowse-ts-friends (if globals-p "define" "friend")) 3573 (ebrowse-ts-friends (if globals-p "define" "friend"))
3574 ('ebrowse-ts-types "type") 3574 (ebrowse-ts-types "type")
3575 (t "unknown")) 3575 (t "unknown"))
3576 "\n"))) 3576 "\n")))
3577 3577
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 25d1410621a..ab315f9eefd 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -648,21 +648,36 @@ detailed description of this mode.
648 (set (make-local-variable 'gud-minor-mode) 'gdbmi) 648 (set (make-local-variable 'gud-minor-mode) 'gdbmi)
649 (setq comint-input-sender 'gdb-send) 649 (setq comint-input-sender 'gdb-send)
650 (when (ring-empty-p comint-input-ring) ; cf shell-mode 650 (when (ring-empty-p comint-input-ring) ; cf shell-mode
651 (let (hfile) 651 (let ((hfile (expand-file-name (or (getenv "GBDHISTFILE")
652 (when (catch 'done 652 (if (eq system-type 'ms-dos)
653 (dolist (file '(".gdbinit" "~/.gdbinit")) 653 "_gdb_history"
654 (if (file-readable-p (setq file (expand-file-name file))) 654 ".gdb_history"))))
655 (with-temp-buffer 655 ;; gdb defaults to 256, but we'll default to comint-input-ring-size.
656 (insert-file-contents file) 656 (hsize (getenv "HISTSIZE")))
657 (and (re-search-forward 657 (dolist (file (append '("~/.gdbinit")
658 "^ *set history filename *\\(.*\\)" nil t) 658 (unless (string-equal (expand-file-name ".")
659 (file-readable-p 659 (expand-file-name "~"))
660 (setq hfile (expand-file-name 660 '(".gdbinit"))))
661 (match-string 1) 661 (if (file-readable-p (setq file (expand-file-name file)))
662 (file-name-directory file)))) 662 (with-temp-buffer
663 (throw 'done t)))))) 663 (insert-file-contents file)
664 (set (make-local-variable 'comint-input-ring-file-name) hfile) 664 ;; TODO? check for "set history save\\( *on\\)?" and do
665 (comint-read-input-ring t)))) 665 ;; not use history otherwise?
666 (while (re-search-forward
667 "^ *set history \\(filename\\|size\\) *\\(.*\\)" nil t)
668 (cond ((string-equal (match-string 1) "filename")
669 (setq hfile (expand-file-name
670 (match-string 2)
671 (file-name-directory file))))
672 ((string-equal (match-string 1) "size")
673 (setq hsize (match-string 2))))))))
674 (and (stringp hsize)
675 (integerp (setq hsize (string-to-number hsize)))
676 (> hsize 0)
677 (set (make-local-variable 'comint-input-ring-size) hsize))
678 (if (stringp hfile)
679 (set (make-local-variable 'comint-input-ring-file-name) hfile))
680 (comint-read-input-ring t)))
666 (gud-def gud-tbreak "tbreak %f:%l" "\C-t" 681 (gud-def gud-tbreak "tbreak %f:%l" "\C-t"
667 "Set temporary breakpoint at current line.") 682 "Set temporary breakpoint at current line.")
668 (gud-def gud-jump 683 (gud-def gud-jump
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 53918b903ee..47cbdf19ed2 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -3127,7 +3127,9 @@ class of the file (using s to separate nested class ids)."
3127 ("^document\\s-.*\\(\n\\)" (1 "< b")) 3127 ("^document\\s-.*\\(\n\\)" (1 "< b"))
3128 ("^end\\(\\>\\)" 3128 ("^end\\(\\>\\)"
3129 (1 (ignore 3129 (1 (ignore
3130 (unless (eq (match-beginning 0) (point-min)) 3130 (when (and (> (match-beginning 0) (point-min))
3131 (eq 1 (nth 7 (save-excursion
3132 (syntax-ppss (1- (match-beginning 0)))))))
3131 ;; We change the \n in front, which is more difficult, but results 3133 ;; We change the \n in front, which is more difficult, but results
3132 ;; in better highlighting. If the doc is empty, the single \n is 3134 ;; in better highlighting. If the doc is empty, the single \n is
3133 ;; both the beginning and the end of the docstring, which can't be 3135 ;; both the beginning and the end of the docstring, which can't be
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 9d40b4d8fd7..c8b156c5441 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -974,7 +974,7 @@ With ARG, do it many times. Negative ARG means move forward."
974 (goto-char (scan-sexps (1+ (point)) -1)) 974 (goto-char (scan-sexps (1+ (point)) -1))
975 (case (char-before) 975 (case (char-before)
976 (?% (forward-char -1)) 976 (?% (forward-char -1))
977 ('(?q ?Q ?w ?W ?r ?x) 977 ((?q ?Q ?w ?W ?r ?x)
978 (if (eq (char-before (1- (point))) ?%) (forward-char -2)))) 978 (if (eq (char-before (1- (point))) ?%) (forward-char -2))))
979 nil) 979 nil)
980 ((looking-at "\\s\"\\|\\\\\\S_") 980 ((looking-at "\\s\"\\|\\\\\\S_")