diff options
| author | Stefan Monnier | 2001-05-31 02:26:43 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-05-31 02:26:43 +0000 |
| commit | 8908cf40d577ecf63c5001fda2be3227979a134b (patch) | |
| tree | 99f65de44c6d4e754ba6388981cb92c41ecc0803 | |
| parent | db3a49a62e4dcc4e2113539f743b5108d3c1a13b (diff) | |
| download | emacs-8908cf40d577ecf63c5001fda2be3227979a134b.tar.gz emacs-8908cf40d577ecf63c5001fda2be3227979a134b.zip | |
(latex-find-indent): Handle the BOBP case.
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 3701a02b6a3..ef5004fffd5 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -1881,41 +1881,43 @@ There might be text before point." | |||
| 1881 | (latex-backward-sexp-1))) | 1881 | (latex-backward-sexp-1))) |
| 1882 | (scan-error | 1882 | (scan-error |
| 1883 | (setq up-list-pos (nth 2 err)))) | 1883 | (setq up-list-pos (nth 2 err)))) |
| 1884 | (if (integerp up-list-pos) | 1884 | (cond |
| 1885 | ;; Have to indent relative to the open-paren. | 1885 | ((= (point-min) pos) 0) ; We're really just indenting the first line. |
| 1886 | (progn | 1886 | ((integerp up-list-pos) |
| 1887 | (goto-char up-list-pos) | 1887 | ;; Have to indent relative to the open-paren. |
| 1888 | (if (and (not tex-indent-allhanging) | 1888 | (goto-char up-list-pos) |
| 1889 | (> pos (progn (latex-down-list) | 1889 | (if (and (not tex-indent-allhanging) |
| 1890 | (forward-comment (point-max)) | 1890 | (> pos (progn (latex-down-list) |
| 1891 | (point)))) | 1891 | (forward-comment (point-max)) |
| 1892 | ;; Align with the first element after the open-paren. | 1892 | (point)))) |
| 1893 | (current-column) | 1893 | ;; Align with the first element after the open-paren. |
| 1894 | ;; We're the first element after a hanging brace. | 1894 | (current-column) |
| 1895 | (goto-char up-list-pos) | 1895 | ;; We're the first element after a hanging brace. |
| 1896 | (+ indent tex-indent-basic (latex-find-indent 'virtual)))) | 1896 | (goto-char up-list-pos) |
| 1897 | ;; We're now at the beginning of a line. | 1897 | (+ indent tex-indent-basic (latex-find-indent 'virtual)))) |
| 1898 | (if (not (and (not virtual) (eq (char-after) ?\\))) | 1898 | ;; We're now at the "beginning" of a line. |
| 1899 | ;; Nothing particular here: just keep the same indentation. | 1899 | ((not (and (not virtual) (eq (char-after) ?\\))) |
| 1900 | (+ indent (current-column)) | 1900 | ;; Nothing particular here: just keep the same indentation. |
| 1901 | ;; We're now looking at a macro call. | 1901 | (+ indent (current-column))) |
| 1902 | (if (looking-at tex-indent-item-re) | 1902 | ;; We're now looking at a macro call. |
| 1903 | ;; Indenting relative to an item, have to re-add the outdenting. | 1903 | ((looking-at tex-indent-item-re) |
| 1904 | (+ indent (current-column) tex-indent-item) | 1904 | ;; Indenting relative to an item, have to re-add the outdenting. |
| 1905 | (let ((col (current-column))) | 1905 | (+ indent (current-column) tex-indent-item)) |
| 1906 | (if (not (eq (char-syntax char) ?\()) | 1906 | (t |
| 1907 | ;; If the first char was not an open-paren, there's | 1907 | (let ((col (current-column))) |
| 1908 | ;; a risk that this is really not an argument to the | 1908 | (if (not (eq (char-syntax char) ?\()) |
| 1909 | ;; macro at all. | 1909 | ;; If the first char was not an open-paren, there's |
| 1910 | (+ indent col) | 1910 | ;; a risk that this is really not an argument to the |
| 1911 | (forward-sexp 1) | 1911 | ;; macro at all. |
| 1912 | (if (< (line-end-position) | 1912 | (+ indent col) |
| 1913 | (save-excursion (forward-comment (point-max)) | 1913 | (forward-sexp 1) |
| 1914 | (point))) | 1914 | (if (< (line-end-position) |
| 1915 | ;; we're indenting the first argument. | 1915 | (save-excursion (forward-comment (point-max)) |
| 1916 | (min (current-column) (+ tex-indent-arg col)) | 1916 | (point))) |
| 1917 | (skip-syntax-forward " ") | 1917 | ;; we're indenting the first argument. |
| 1918 | (current-column))))))))))) | 1918 | (min (current-column) (+ tex-indent-arg col)) |
| 1919 | (skip-syntax-forward " ") | ||
| 1920 | (current-column)))))))))) | ||
| 1919 | 1921 | ||
| 1920 | (run-hooks 'tex-mode-load-hook) | 1922 | (run-hooks 'tex-mode-load-hook) |
| 1921 | 1923 | ||