2013-01-19  Mads Jensen  <[email protected]>

        * style/ifthen.el: New style.

I've checked pretty thoroughly, and run this file a few times, and
embarrassing things should not be present; the auto type stuff works. I
wanted to work a bit with the TeX-auto-add-type.

Regarding the savebox patch, I'll fix the issues in the coming days, and
resubmit it.
-- 
Med Venlig Hilsen / Kind Regards,
Mads Jensen
Rubinsteinsvej 31,st.th
DK-2450 Kbh. SV
Denmark
+45 6168 8518
My brain is my second favorite organ.
      -- Woody Allen
;;; ifthen.el --- AUCTeX style for `ifthen.sty'

;; Copyright (C) 2013 Free Software Foundation, Inc.

;; Author: Mads Jensen <[email protected]>
;; Maintainer: [email protected]
;; Keywords: tex

;; This file is part of AUCTeX.

;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING.  If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.

;;; Commentary:

;; This file adds support for `ifthen.sty'

;;; Code:

(TeX-add-style-hook
 "ifthen"
 (lambda ()
   (TeX-auto-add-type "boolean" "LaTeX")

   (setq LaTeX-auto-regexp-list
         (append '(("\\\\\\(new\\|provide\\)boolean *{?\\([A-Za-z]+\\)}?"
                    2 LaTeX-auto-boolean))
                 LaTeX-auto-regexp-list))

   (TeX-add-symbols
    '("ifthenelse" 3)
    "and" "not" "or"
    '("equal" 2)
    '("isundefined" TeX-arg-macro)
    '("lengthtest" t)
    '("boolean" t)
    '("newboolean" TeX-arg-define-boolean)
    '("setboolean" TeX-arg-boolean "Value (true or false, case insensitive)")
    '("whiledo" 2))

   ;; Fontification
   (when (and (featurep 'font-latex)
	      (eq TeX-install-font-lock 'font-latex-setup))
     (font-latex-add-keywords '(("ifthenelse" "{{{")
                                ("isundefined" "{")
                                ("newboolean" "{")
                                ("setboolean" "{{")
                                ("whiledo" "{{")
                                ("lengthtest" "{{")) 'function)
     ;; Tell font-lock about the update.
     (setq font-lock-set-defaults nil)
     (font-lock-set-defaults))))

;; the following two functions were adapted from `TeX-arg-counter' and
;; `TeX-arg-define-counter'
(defun TeX-arg-define-boolean (optional &optional prompt)
  "Prompt for a LaTeX boolean.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one.  Use PROMPT as the prompt
string."
  (TeX-arg-boolean optional prompt t))

(defun TeX-arg-boolean (optional &optional prompt definition)
  "Prompt for a LaTeX boolean.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one.  Use PROMPT as the prompt
string.  If DEFINITION is non-nil, add the chosen boolean to the
list of defined booleans."
  (let ((boolean (completing-read 
                  (TeX-argument-prompt optional prompt "Boolean")
                                  (LaTeX-boolean-list))))
    (if (and definition (not (string-equal "" boolean)))
        (LaTeX-add-booleans boolean))
    (TeX-argument-insert boolean optional)))

(defvar LaTeX-ifthen-package-options nil
  "Package options for ifthen.")

;; ifthen.el ends here

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to