auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 68d2559f1672d9992fb70


From: Mosè Giordano
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 68d2559f1672d9992fb70a5a35e2b3e2e78ff88e
Date: Tue, 24 Dec 2013 16:38:27 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  68d2559f1672d9992fb70a5a35e2b3e2e78ff88e (commit)
      from  cddd3c1d4b8d7c92c07650f97c74b15c0f4f5f8e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 68d2559f1672d9992fb70a5a35e2b3e2e78ff88e
Author: Mosè Giordano <address@hidden>
Date:   Tue Dec 24 17:33:19 2013 +0100

    Add font name completion in fontspec.el.
    
    * tex-style.el (LaTeX-fontspec-arg-font-search): New customizable
    variable.
    (LaTeX-fontspec-font-list-default): Ditto.
    
    * style/fontspec.el (LaTeX-fontspec-arg-font): New function.
    ("fontspec"): Use it.
    
    * doc/changes.texi: Mention `LaTeX-fontspec-arg-font-search' and
    `LaTeX-fontspec-font-list-default'.

diff --git a/ChangeLog b/ChangeLog
index 63945c8..0c376c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2013-12-24  Mosè Giordano  <address@hidden>
+
+       * tex-style.el (LaTeX-fontspec-arg-font-search): New customizable
+       variable.
+       (LaTeX-fontspec-font-list-default): Ditto.
+
+       * style/fontspec.el (LaTeX-fontspec-arg-font): New function.
+       ("fontspec"): Use it.
+
+       * doc/changes.texi: Mention `LaTeX-fontspec-arg-font-search' and
+       `LaTeX-fontspec-font-list-default'.
+
 2013-12-20  Mosè Giordano  <address@hidden>
 
        * style/imakeidx.el ("imakeidx"): Move addition of options to
diff --git a/doc/changes.texi b/doc/changes.texi
index a6147fb..bd7d782 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -39,8 +39,9 @@ Completion for class options of the standard @LaTeX{} classes 
is
 provided as well.
 
 @item
-New user options @code{LaTeX-default-author} and
address@hidden  A new possible value
+New user options @code{LaTeX-default-author},
address@hidden, @code{LaTeX-fontspec-arg-font-search},
+and @code{LaTeX-fontspec-font-list-default}.  A new possible value
 (@code{show-all-optional-args}) for
 @code{TeX-insert-macro-default-style} was added.
 
diff --git a/style/fontspec.el b/style/fontspec.el
index 90286b5..f9137fb 100644
--- a/style/fontspec.el
+++ b/style/fontspec.el
@@ -131,6 +131,38 @@
     ("Vertical" ("RotatedGlyphs")))
   "Font features options for macros of the fontspec package.")
 
+(defvar LaTeX-fontspec-font-list nil
+  "List of the fonts accessible to fontspec.")
+
+(defun LaTeX-fontspec-arg-font (optional &optional prompt)
+  "Prompt for a font name with completion.
+If OPTIONAL is non-nil, insert the resulting value as an optional
+argument, otherwise as a mandatory one.  Use PROMPT as the prompt
+string.
+
+Customize `LaTeX-fontspec-arg-font-search' in order to decide how
+to retrieve the list of fonts."
+  (unless LaTeX-fontspec-font-list
+    (when (if (eq LaTeX-fontspec-arg-font-search 'ask)
+             (not (y-or-n-p "Find font yourself? "))
+           LaTeX-fontspec-arg-font-search)
+      (message "Searching for fonts...")
+      (with-temp-buffer
+       (shell-command "luaotfload-tool --list=basename" t)
+       ;; Search for the font base names and full names, and add them to
+       ;; `LaTeX-fontspec-font-list'.  The list is in the form
+       ;;     <base name><TAB><full name><TAB><version>
+       (while
+           (re-search-forward "^\\([^\n\r\t]*\\)\t\\([^\n\r\t]*\\)\t.*$" nil t)
+         (add-to-list 'LaTeX-fontspec-font-list (match-string-no-properties 1))
+         (add-to-list 'LaTeX-fontspec-font-list
+                      (match-string-no-properties 2))))))
+  (TeX-argument-insert
+   (completing-read
+    (TeX-argument-prompt optional prompt "Font name")
+    (or LaTeX-fontspec-font-list LaTeX-fontspec-font-list-default))
+   optional))
+
 (TeX-add-style-hook
  "fontspec"
  (lambda ()
@@ -138,24 +170,24 @@
    (TeX-add-symbols
     ;; Font selection
     '("fontspec" [TeX-arg-key-val LaTeX-fontspec-font-features "Font features"]
-      "Font name")
+      LaTeX-fontspec-arg-font)
     ;; Default font families
     '("setmainfont"
       [TeX-arg-key-val LaTeX-fontspec-font-features "Font features"]
-      "Main font name")
+      (LaTeX-fontspec-arg-font "Main font name"))
     '("setsansfont"
       [TeX-arg-key-val LaTeX-fontspec-font-features "Font features"]
-      "Sans font name")
+      (LaTeX-fontspec-arg-font "Sans font name"))
     '("setmonofont"
       [TeX-arg-key-val LaTeX-fontspec-font-features "Font features"]
-      "Mono font name")
+      (LaTeX-fontspec-arg-font "Mono font name"))
     ;; New commands to select font families
     '("newfontfamily" TeX-arg-define-macro
       [TeX-arg-key-val LaTeX-fontspec-font-features "Font features"]
-      "Font name")
+      LaTeX-fontspec-arg-font)
     '("newfontface" TeX-arg-define-macro
       [TeX-arg-key-val LaTeX-fontspec-font-features "Font features"]
-      "Font name")
+      LaTeX-fontspec-arg-font)
     ;; Math(s) fonts
     '("setmathrm" [ "Font features" ] "Font name")
     '("setmathsf" [ "Font features" ] "Font name")
@@ -165,7 +197,7 @@
     "emshape"
     "eminnershape"
     ;; Default settings
-    '("defaultfontfeatures" [ "Font name" ]
+    '("defaultfontfeatures" [ LaTeX-fontspec-arg-font ]
       (TeX-arg-key-val LaTeX-fontspec-font-features "Font features"))
     ;; Changing the currently selected features
     '("addfontfeatures"
diff --git a/tex-style.el b/tex-style.el
index 05a706e..b403db1 100644
--- a/tex-style.el
+++ b/tex-style.el
@@ -254,6 +254,31 @@ produced by emp.sty and then re-LaTeX the document."
   :type 'boolean
   :group 'LaTeX-style)
 
+;; style/fontspec.el
+
+(defcustom LaTeX-fontspec-arg-font-search t
+  "If `LaTeX-fontspec-arg-font' should search for fonts.
+If the value is t, fonts are retrieved automatically and provided
+for completion.  If the value is nil,
+`LaTeX-fontspec-font-list-default' is used for completion.  If
+the value is `ask', you are asked for the method to use every
+time `LaTeX-fontspec-arg-font' is called.
+
+`LaTeX-fontspec-arg-font' calls `luaotf-load --list=basename' to
+automatically get the list of fonts.  This requires
+`luaotfload-tool' version 2.3 or higher in order to work."
+  :group 'LaTeX-style
+  :type '(choice
+         (const :tag "Search automatically" t)
+         (const :tag "Use default font list" nil)
+         (const :tag "Ask what to do" ask)))
+
+(defcustom LaTeX-fontspec-font-list-default nil
+  "List of default fonts to be used as completion for
+`LaTeX-fontspec-arg-font'."
+  :group 'LaTeX-style
+  :type '(repeat (string :tag "Font")))
+
 ;; style/graphicx.el
 
 (defcustom LaTeX-includegraphics-extensions

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |   12 ++++++++++++
 doc/changes.texi  |    5 +++--
 style/fontspec.el |   46 +++++++++++++++++++++++++++++++++++++++-------
 tex-style.el      |   25 +++++++++++++++++++++++++
 4 files changed, 79 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

[Prev in Thread] Current Thread [Next in Thread]