Mercurial > emacs
annotate lisp/textmodes/bibtex-style.el @ 111346:2d0c056a50d8
Fix unified mouse highlight after compiling on Unix.
xdisp.c (x_consider_frame_title, tool_bar_lines_needed): Move
prototypes to HAVE_WINDOW_SYSTEM-only part.
frame.h (MOUSE_HL_INFO): Fix definition to work both for
TTY-only and GUI builds.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Fri, 05 Nov 2010 20:07:42 +0200 |
parents | 77c2be84591c |
children | 417b1e4d63cd |
rev | line source |
---|---|
78523
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1 ;;; bibtex-style.el --- Major mode for BibTeX Style files |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2 |
110538
77c2be84591c
Move some autoloaded auto-mode-alist entries to files.el.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
3 ;; Copyright (C) 2005, 2007, 2008, 2009, 2010 |
77c2be84591c
Move some autoloaded auto-mode-alist entries to files.el.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
78523
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
5 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
6 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca> |
106253
ea646047455b
* textmodes/bibtex-style.el: Add "Keywords: tex".
Kevin Ryde <user42@zip.com.au>
parents:
105957
diff
changeset
|
7 ;; Keywords: tex |
78523
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
8 |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92692
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92692
diff
changeset
|
10 |
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92692
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
78523
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92692
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92692
diff
changeset
|
14 ;; (at your option) any later version. |
78523
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
15 |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92692
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
78523
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
20 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92692
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
78523
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
23 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
24 ;;; Commentary: |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
25 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
26 ;; Done: font-lock, imenu, outline, commenting, indentation. |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
27 ;; Todo: tab-completion. |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
28 ;; Bugs: |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
29 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
30 ;;; Code: |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
31 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
32 (defvar bibtex-style-mode-syntax-table |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
33 (let ((st (make-syntax-table))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
34 (modify-syntax-entry ?% "<" st) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
35 (modify-syntax-entry ?\n ">" st) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
36 (modify-syntax-entry ?\{ "(}" st) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
37 (modify-syntax-entry ?\} "){" st) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
38 (modify-syntax-entry ?\" "\"" st) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
39 (modify-syntax-entry ?. "_" st) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
40 (modify-syntax-entry ?' "'" st) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
41 (modify-syntax-entry ?# "'" st) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
42 (modify-syntax-entry ?* "." st) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
43 (modify-syntax-entry ?= "." st) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
44 (modify-syntax-entry ?$ "_" st) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
45 st)) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
46 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
47 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
48 (defconst bibtex-style-commands |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
49 '("ENTRY" "EXECUTE" "FUNCTION" "INTEGERS" "ITERATE" "MACRO" "READ" |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
50 "REVERSE" "SORT" "STRINGS")) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
51 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
52 (defconst bibtex-style-functions |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
53 ;; From http://www.eeng.dcu.ie/local-docs/btxdocs/btxhak/btxhak/node4.html. |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
54 '("<" ">" "=" "+" "-" "*" ":=" |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
55 "add.period$" "call.type$" "change.case$" "chr.to.int$" "cite$" |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
56 "duplicate$" "empty$" "format.name$" "if$" "int.to.chr$" "int.to.str$" |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
57 "missing$" "newline$" "num.names$" "pop$" "preamble$" "purify$" "quote$" |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
58 "skip$" "stack$" "substring$" "swap$" "text.length$" "text.prefix$" |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
59 "top$" "type$" "warning$" "while$" "width$" "write$")) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
60 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
61 (defvar bibtex-style-font-lock-keywords |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
62 `((,(regexp-opt bibtex-style-commands 'words) . font-lock-keyword-face) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
63 ("\\w+\\$" . font-lock-keyword-face) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
64 ("\\<\\(FUNCTION\\|MACRO\\)\\s-+{\\([^}\n]+\\)}" |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
65 (2 font-lock-function-name-face)))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
66 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
67 ;;;###autoload |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
68 (define-derived-mode bibtex-style-mode nil "BibStyle" |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
69 "Major mode for editing BibTeX style files." |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
70 (set (make-local-variable 'comment-start) "%") |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
71 (set (make-local-variable 'outline-regexp) "^[a-z]") |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
72 (set (make-local-variable 'imenu-generic-expression) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
73 '((nil "\\<\\(FUNCTION\\|MACRO\\)\\s-+{\\([^}\n]+\\)}" 2))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
74 (set (make-local-variable 'indent-line-function) 'bibtex-style-indent-line) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
75 (set (make-local-variable 'parse-sexp-ignore-comments) t) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
76 (setq font-lock-defaults |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
77 '(bibtex-style-font-lock-keywords nil t |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
78 ((?. . "w"))))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
79 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
80 (defun bibtex-style-indent-line () |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
81 "Indent current line of BibTeX Style code." |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
82 (interactive) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
83 (let* ((savep (point)) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
84 (indent (condition-case nil |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
85 (save-excursion |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
86 (forward-line 0) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
87 (skip-chars-forward " \t") |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
88 (if (>= (point) savep) (setq savep nil)) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
89 (max (bibtex-style-calculate-indentation) 0)) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
90 (error 0)))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
91 (if savep |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
92 (save-excursion (indent-line-to indent)) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
93 (indent-line-to indent)))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
94 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
95 (defcustom bibtex-style-indent-basic 2 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
96 "Basic amount of indentation to use in BibTeX Style mode." |
80261
4af0bb174714
* textmodes/css-mode.el (css-indent-offset, css-electric-keys):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
97 :version "22.2" |
4af0bb174714
* textmodes/css-mode.el (css-indent-offset, css-electric-keys):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
98 :type 'integer |
4af0bb174714
* textmodes/css-mode.el (css-indent-offset, css-electric-keys):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
99 :group 'bibtex) |
78523
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
100 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
101 (defun bibtex-style-calculate-indentation (&optional virt) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
102 (or |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
103 ;; Stick the first line at column 0. |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
104 (and (= (point-min) (line-beginning-position)) 0) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
105 ;; Commands start at column 0. |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
106 (and (looking-at (regexp-opt bibtex-style-commands 'words)) 0) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
107 ;; Trust the current indentation, if such info is applicable. |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
108 (and virt (save-excursion (skip-chars-backward " \t{") (bolp)) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
109 (current-column)) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
110 ;; Put leading close-paren where the matching open brace would be. |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
111 (and (looking-at "}") |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
112 (condition-case nil |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
113 (save-excursion |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
114 (up-list -1) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
115 (bibtex-style-calculate-indentation 'virt)) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
116 (scan-error nil))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
117 ;; Align leading "if$" with previous command. |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
118 (and (looking-at "if\\$") |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
119 (condition-case nil |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
120 (save-excursion |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
121 (backward-sexp 3) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
122 (bibtex-style-calculate-indentation 'virt)) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
123 (scan-error |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
124 ;; There is no command before the "if$". |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
125 (condition-case nil |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
126 (save-excursion |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
127 (up-list -1) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
128 (+ bibtex-style-indent-basic |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
129 (bibtex-style-calculate-indentation 'virt))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
130 (scan-error nil))))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
131 ;; Right after an opening brace. |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
132 (condition-case err (save-excursion (backward-sexp 1) nil) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
133 (scan-error (goto-char (nth 2 err)) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
134 (+ bibtex-style-indent-basic |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
135 (bibtex-style-calculate-indentation 'virt)))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
136 ;; Default, align with previous command. |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
137 (let ((fai ;; First arm of an "if$". |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
138 (condition-case nil |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
139 (save-excursion |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
140 (forward-sexp 2) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
141 (forward-comment (point-max)) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
142 (looking-at "if\\$")) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
143 (scan-error nil)))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
144 (save-excursion |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
145 (condition-case err |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
146 (while (progn |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
147 (backward-sexp 1) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
148 (save-excursion (skip-chars-backward " \t{") (not (bolp))))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
149 (scan-error nil)) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
150 (+ (current-column) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
151 (if (or fai (looking-at "ENTRY")) bibtex-style-indent-basic 0)))))) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
152 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
153 |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
154 (provide 'bibtex-style) |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
155 ;; arch-tag: b20ad41a-fd36-466e-8fd2-cc6137f9c55c |
437c27340640
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
156 ;;; bibtex-style.el ends here |