From 0864ffaba6e44e8fc49f9871adb1200cc0885f9e Mon Sep 17 00:00:00 2001
From: Chizi123 <joelgrun@gmail.com>
Date: Mon, 10 Jun 2019 11:51:03 +0000
Subject: [PATCH] Made verilog-mode update every week, code from auto-package-update

---
 config.org |  173 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 121 insertions(+), 52 deletions(-)

diff --git a/config.org b/config.org
index 7bc3bff..283258b 100644
--- a/config.org
+++ b/config.org
@@ -1,5 +1,5 @@
 #+TITLE: My Emacs configuration
-#  LocalWords:  poppler mingw emacs eq nt gnuplot setenv mapconcat el cond minibuffer pdf color Smartparens smartparens yas aindent whitespace eldoc ielm ibuffer hippie pscp pos Spaceline spaceline powerline spacemacs seperator dir Yasnippet yasnippet flycheck magit fullscreen CEDET askifnotset semanticdb EDE ede gdb srefactor analyzer eval cdb autosetup ghostscript math unicode reftex bibtex TeXcount texcount str latin rkt PlantUML plantuml autoload alist matlab verilog ds vh src fontify natively fortran dvipng plist xcolor
+#  LocalWords:  poppler mingw emacs eq nt gnuplot setenv mapconcat el cond minibuffer pdf color Smartparens smartparens yas aindent whitespace eldoc ielm ibuffer hippie pscp pos Spaceline spaceline powerline spacemacs seperator dir Yasnippet yasnippet flycheck magit fullscreen CEDET askifnotset semanticdb EDE ede gdb srefactor analyzer eval cdb autosetup ghostscript math unicode reftex bibtex TeXcount texcount str latin rkt PlantUML plantuml autoload alist matlab verilog ds vh src fontify natively fortran dvipng plist xcolor EXWM Zenburn setq zenburn defun dolist init config DejaVu ispell aspell flyspell kbd recentf sexp ov bg listp defadvice progn prog keyfreq autosave dabbrev hl gc linum linux utf RET ARG arg configs backends contribs AucTex tex auctex LaTeX url
 
 * Windows dependencies
 Dependencies needed for Aspell, poppler PDF-tools, compilers and ghost-script provided by mingw64
@@ -17,25 +17,38 @@
 #+BEGIN_SRC emacs-lisp
   (setq emacs-theme 'zenburn)
 
+  (defun disable-all-themes ()
+    (dolist (i custom-enabled-themes)
+      (disable-theme i)))
+
   (cond ((eq emacs-theme 'zenburn)
          (use-package zenburn-theme
            :ensure t
+           :init
+           (disable-all-themes)
            :config
            (load-theme 'zenburn t)))
         ((eq emacs-theme 'doom-one)
          (use-package doom-themes
            :ensure t
+           :init
+           (disable-all-themes)
            :config
            (setq doom-themes-enable-bolt t
                  doom-themes-enable-italic t)
            (load-theme 'doom-one t)
            (doom-themes-visual-bell-config)
-           (doom-themes-org-config))))
+           (doom-themes-org-config)))
+        ((eq emacs-theme 'none)
+         (disable-all-themes)))
 #+END_SRC
 
 ** Default font
-#+BEGIN_SRC emacs-lisp
-  (set-frame-font "DejaVu Sans Mono" nil t)
+#+BEGIN_SRC emacs-lisp 
+  ;;(set-frame-font "DejaVu Sans Mono" nil t)
+  (set-frame-font "Dank Mono-11" nil t)
+  (set-face-italic 'font-lock-comment-face t)
+  (set-face-italic 'font-lock-keyword-face t)
 #+END_SRC
 
 ** Remove menu bar, toolbar, but keep scroll bar
@@ -153,10 +166,10 @@
 
 *** Enable communication with helm
 #+BEGIN_SRC emacs-lisp
-(use-package helm-projectile
-  :ensure t
-  :config
-  (helm-projectile-on))
+  (use-package helm-projectile
+    :ensure t
+    :config
+    (helm-projectile-on))
 #+END_SRC
 
 * Small tweaks
@@ -452,15 +465,16 @@
 ** Spaceline
 A little easier to read than the default emacs mode line
 #+BEGIN_SRC emacs-lisp
-  (use-package spaceline
-    :ensure t
-    :config
-    (require 'spaceline-config)
-    (setq spaceline-buffer-encoding-abbrev-p t)
-    (setq spaceline-line-column-p t)
-    (setq spaceline-line-p t)
-    (setq powerline-default-separator (quote arrow))
-    (spaceline-spacemacs-theme))
+    (use-package spaceline
+      :ensure t
+      :config
+      (require 'spaceline-config)
+      (setq spaceline-buffer-encoding-abbrev-p t)
+      (setq spaceline-line-column-p t)
+      (setq spaceline-line-p t)
+      (setq powerline-default-separator (quote arrow))
+      (spaceline-spacemacs-theme)
+      (spaceline-helm-mode))
 #+END_SRC
 
 ** No separator
@@ -693,13 +707,14 @@
 *** Latex
 **** AucTex
 #+BEGIN_SRC emacs-lisp
-(use-package tex
-  :ensure auctex
-  :config
-  (setq TeX-auto-save t)
-  (setq TeX-parse-self t)
-  (setq doc-view-ghostscript-program "c:/msys64/mingw64/bin/gswin32c.exe")
-  (setq preview-gs-command "c:/msys64/mingw64/bin/gs.exe"))
+  (use-package tex
+    :ensure auctex
+    :config
+    (setq TeX-auto-save t)
+    (setq TeX-parse-self t)
+    (setq TeX-view-program-selection '((output-pdf "PDF Tools"))
+          TeX-source-correlate-start-server t)
+    (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer))
 #+END_SRC
 
 **** Company
@@ -728,20 +743,15 @@
     (add-to-list 'company-backends 'company-bibtex))
 #+END_SRC
 
-**** Preview pane
-#+BEGIN_SRC emacs-lisp
-(use-package latex-preview-pane
-  :ensure t
-  :config
-  (latex-preview-pane-enable))
-#+END_SRC
-
-**** TeXcount
+**** COMMENT TeXcount
      Word counts in latex
      #+BEGIN_SRC emacs-lisp
-       (when (eq system-type 'windows-nt)
-         (add-to-list 'exec-path "c:/Users/joelg/TeXcount_3_1_1")
-         (setenv "PATH" (mapconcat #'identity exec-path path-separator)))
+       (defun get-texcount-latest()
+         (url-copy-file "https://app.uio.no/ifi/texcount/download.php?file=texcount_3_1_1.zip" "~/.texcount/texcount.zip" 1)
+         (shell-command "unzip -o ~/.texcount/texcount.zip -d ~/.texcount")
+         (add-to-list 'exec-path "~/.texcount/texcount.pl"))
+
+       (get-texcount-latest)
 
        (defun texcount ()
          (interactive)
@@ -791,13 +801,68 @@
 #+END_SRC
 
 *** Verilog
+**** Get latest version
+Pull the latest version from the web
+#+BEGIN_SRC emacs-lisp
+  (defun get-verilog-latest()
+    (if (not(file-directory-p "~/.emacs.d/elpa/verilog-mode"))
+        (make-directory "~/.emacs.d/elpa/verilog-mode"))
+    (if (file-exists-p "~/.emacs.d/elpa/verilog-mode/verilog-mode.el")
+        (delete-file "~/.emacs.d/elpa/verilog-mode/verilog-mode.el"))
+    (url-copy-file "https://www.veripool.org/ftp/verilog-mode.el" "~/.emacs.d/elpa/verilog-mode/verilog-mode.el" 1))
+#+END_SRC
+
+**** Integrate into emacs
 Add updated version and integrate it with Emacs.
 #+BEGIN_SRC emacs-lisp
-  (add-to-list 'load-path "~/.emacs.d/elpa/verilog-mode-20190324/verilog-mode.el")
-  (require 'verilog-mode)
+    (defun verilog-read-file-as-string (file)
+      "Read FILE contents."
+      (when (file-exists-p file)
+        (with-temp-buffer
+          (insert-file-contents file)
+          (buffer-string))))
 
-  (autoload 'verilog-mode "verilog-mode" "Verilog mode" t )
-  (add-to-list 'auto-mode-alist '("\\.[ds]?vh?\\'" . verilog-mode))
+    (defun verilog-write-string-to-file (file string)
+      "Substitute FILE contents with STRING."
+      (with-temp-buffer
+        (insert string)
+        (when (file-writable-p file)
+          (write-region (point-min)
+                        (point-max)
+                        file))))
+
+    (defun verilog-today-day ()
+      (time-to-days (current-time)))
+
+    (defun should-update-verilog-p ()
+      "Return non-nil when an update is due."
+      (and
+       (or
+        (not (file-exists-p "~/.emacs.d/.last-verilog-update-day"))
+        (if (>= (/ (- (verilog-today-day) (verilog-read-last-update-day)) 7) 1)
+            t
+          nil))))
+
+    (defun verilog-read-last-update-day ()
+      "Read last update day."
+      (string-to-number
+       (verilog-read-file-as-string "~/.emacs.d/.last-verilog-update-day")))
+
+    (defun verilog-write-current-day ()
+      "Store current day."
+      (verilog-write-string-to-file
+       "~/.emacs.d/.last-verilog-update-day"
+       (int-to-string (verilog-today-day))))
+
+    (use-package verilog-mode
+      :init
+      (when (should-update-verilog-p)
+          (get-verilog-latest)
+          (verilog-write-current-day))
+      (add-to-list 'load-path "~/.emacs.d/elpa/verilog-mode/verilog-mode.el")
+      :config
+      (autoload 'verilog-mode "verilog-mode" "Verilog mode" t )
+      (add-to-list 'auto-mode-alist '("\\.[ds]?vh?\\'" . verilog-mode)))
 #+END_SRC
 
 * Org mode
@@ -839,16 +904,22 @@
 *** Languages
 Add C to org babel supported languages
 #+BEGIN_SRC emacs-lisp
-  (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t)
-                                                           (C . t)
-                                                           (python . t)
-                                                           (latex . t)
-                                                           (scheme . t)
-                                                           (gnuplot . t)
-                                                           (matlab . t)
-                                                           (plantuml . t)
-                                                           (fortran . t)
-                                                           (java . t)))
+    (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t)
+                                                             (C . t)
+                                                             (python . t)
+                                                             (latex . t)
+                                                             (scheme . t)
+                                                             (gnuplot . t)
+                                                             (matlab . t)
+                                                             (plantuml . t)
+                                                             (fortran . t)
+                                                             (java . t)
+                                                             (plantuml . t)))
+#+END_SRC
+
+**** Plantuml path
+#+BEGIN_SRC emacs-lisp
+  (setq org-plantuml-jar-path plantuml-jar-path)
 #+END_SRC
 
 ** Latex preview fragments match colour
@@ -858,5 +929,3 @@
     (plist-put dvipng--plist :use-xcolor t)
     (plist-put dvipng--plist :image-converter '("dvipng -D %D -T tight -o %O %f")))
 #+END_SRC
-
-

--
Gitblit v1.9.3