auctex
[Top][All Lists]
Advanced

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

[AUCTeX] context-en.el and context.el files modifications.


From: Carlos
Subject: [AUCTeX] context-en.el and context.el files modifications.
Date: Tue, 01 May 2018 08:49:05 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

The module simplefonts has been integrated/merged into ConTeXt for a few years 
now. check the ConTeXt wiki http://wiki.contextgarden.net/Simplefonts for more 
info.

so pretty much if you want to have a

\definefontfamily[def][rm][I love lucy.otf]

on the editor with auctex, you'd have to select it on the menu with the 
mouse/trackpad or whatever other input device in existence. There's no key 
binding that would allow me to do so.

fontfamily was never included on the context-en.el file's var 
ConText-define-list-en.

Don't know why, but it is what it is. 

\definefontfamily takes - for as long as I remember - three mandatory arguments

\definefontfamily is ConTeXt's fontspec

Then you also have 
\setupbodyfont[whatever_definition_you_set_with_definefontfamily]

which will load the font

Of course, bodyfont is on the setup-list, but what good does it do, without a 
key bound to it.

To recap: if you want to watch <I love lucy.otf> you'd have to make sure is 
loaded accordingly with mtxrun --script fonts reload. According to some,  
context --generate works the same way, but I guess it depends. For example, 
after adding a font to my TEXMFLOCAL, it was indeed mtxrun and not context 
--generate which did the trick for me.., According to the context wiki, that's 
the recommended method either way, see 
http://wiki.contextgarden.net/Fonts_in_LuaTeX#Installing_new_fonts

My lisp is not anywhere where I would like it to be. But I'm not gonna go 
around asking Mosẽ for everything  related to that context file. I just 
followed some of the same structure laid out by Berend, Mose, Tassilo and 
whoever has written on that file before me.

Questions and answers:

Have you signed the copyright notice and all supplemental disclosures?

Yes I have.

Have you send the paperwork as outlined by the organization?

Yes.

Have you copied any part of the code?

I copied some  just to follow a structure on that file, and added some code at 
the same time. I also added a string that reads fontfamily to the context-en.el 
file because it never existed on that file in the first place. What use is 
anyway that defcustom and the function and the variable without that string?

There's a possibility that it will disrupt context

Then don't add the code. :)

Is there anything else that you'd like us to address?

No. Thank you.



--- a/Documents/context.el
+++ b/usr/share/emacs/site-lisp/auctex/context.el
@@ -629,6 +629,19 @@ inserted after the sectioning command."
   :type 'string)
 (make-variable-buffer-local 'ConTeXt-default-environment)
 
+(defcustom ConTeXt-default-define "accent"
+  "*The default define when creating new ones with `ConTeXt-define'."
+  :group 'ConTeXt-define
+  :type 'string)
+;;(make-variable-buffer-local 'ConTeXt-define-list)
+(make-variable-buffer-local 'ConTeXt-default-list)
+
+(defcustom ConTeXt-default-setup "align"
+  "*The default setup when creating new ones with `ConTeXt-setup'."
+  :group 'ConTeXt-setup
+  :type 'string)
+(make-variable-buffer-local 'ConTeXt-setup-list)
+
 (TeX-auto-add-type "environment" "ConTeXt")
 
 (defadvice ConTeXt-add-environments (after ConTeXt-invalidate-menu (&rest 
environments) activate)
@@ -686,6 +699,54 @@ With optional ARG, modify current environment."
          (ConTeXt-modify-environment environment)
        (ConTeXt-environment-menu environment)))))
 
+(defun ConTeXt-define (arg)
+  "Make ConTeXt define with (\\define).
+With mandatory & optional ARG, modify current define."
+  (interactive "*P")
+  (let* ((default (cond
+                  ((TeX-near-bobp) "accent")
+                  (t ConTeXt-default-define)))
+        (define
+         (completing-read (concat "Define type (default " default "): ")
+                          ConTeXt-define-list nil nil nil
+                          'ConTeXt-define-list default)))
+    ;; Use `definition' as default for the next time only if it is different
+    ;; from the current default.
+    (unless (equal define default)
+      (setq ConTeXt-default-define define))
+
+    (let ((entry (assoc define ConTeXt-define-list)))
+      (if (null entry)
+         (ConTeXt-add-environments (list define)))
+
+      (if arg
+         (ConTeXt-modify-environment define)
+       (ConTeXt-define-menu define)))))
+
+(defun ConTeXt-setup (arg)
+  "Make ConTeXt setup (\\setup).
+With mandatory & optional ARG, modify current setup."
+  (interactive "*P")
+  (let* ((default (cond
+                  ((TeX-near-bobp) "text")
+                  (t ConTeXt-default-setup)))
+        (setup
+         (completing-read (concat "Setup type (default " default "): ")
+                          ConTeXt-setup-list nil nil nil
+                          'ConTeXt-setup-list default)))
+    ;; Use `setup' as default for the next time only if it is different
+    ;; from the current default.
+    (unless (equal setup default)
+      (setq ConTeXt-default-setup setup))
+
+    (let ((entry (assoc setup ConTeXt-setup-list)))
+      (if (null entry)
+         (ConTeXt-add-environments (list setup)))
+
+      (if arg
+         (ConTeXt-modify-environment setup)
+       (ConTeXt-setup-menu setup)))))
+
 (defun ConTeXt-modify-environment (environment)
   "Modify current environment."
   (save-excursion
@@ -1308,6 +1369,8 @@ else.  There might be text before point."
     ;; likely to change in the future
     (define-key map "\C-c!"    'ConTeXt-work-on-environment)
     (define-key map "\C-c\C-e" 'ConTeXt-environment)
+    (define-key map "\C-c\C-d" 'ConTeXt-define)
+    (define-key map "\C-c\C-o" 'ConTeXt-setup)
     (define-key map "\C-c\n"   'ConTeXt-insert-item)
     (or (key-binding "\e\r")
        (define-key map "\e\r"    'ConTeXt-insert-item)) ;*** Alias
@@ -1334,6 +1397,10 @@ else.  There might be text before point."
 ;; match.)
 (defvar ConTeXt-environment-menu-name "Insert Environment   (C-c C-e)")
 
+(defvar ConTeXt-define-menu-name "Insert define   (C-c C-d)")
+
+(defvar ConTeXt-setup-menu-name "Insert setup   (C-c C-o)")
+
 (defun ConTeXt-environment-menu-entry (entry)
   "Create an entry for the environment menu."
   (vector (car entry) (list 'ConTeXt-environment-menu (car entry)) t))
@@ -1527,7 +1594,7 @@ else.  There might be text before point."
      ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"]
      "-"
      ["Comment or Uncomment Region"
-      comment-or-uncomment-region
+      TeX-comment-or-uncomment-region
       :help "Make the selected region outcommented or active again"]
      ["Comment or Uncomment Paragraph"
       TeX-comment-or-uncomment-paragraph




reply via email to

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