]> git.eshelyaron.com Git - dotfiles.git/commitdiff
Simplify Emacs configuration
authorEshel Yaron <me@eshelyaron.com>
Fri, 20 Oct 2023 11:43:41 +0000 (13:43 +0200)
committerEshel Yaron <me@eshelyaron.com>
Fri, 20 Oct 2023 11:43:41 +0000 (13:43 +0200)
.emacs.d/init.el

index b860e1a242ca4bfb601c412fad04f11143a970fe..f386e4854bef8b0f25a52fed26fed6fc03eb7dd3 100644 (file)
 (elpaca embark-consult)
 (elpaca emms)
 (elpaca gnu-elpa-keyring-update)
-(elpaca graphql-mode)
 (elpaca htmlize)
 (elpaca keycast)
 (elpaca kubernetes)
          :repo "git://git.sv.gnu.org/emacs/elpa"
          :local-repo "oauth2"
          :branch "externals/oauth2"))
-(elpaca (ledger-mode
-         :files (:defaults)))
 (elpaca (lin
          :pre-build (("emacs" "--batch" "-l" "ox-texinfo" "README.org"
                       "--eval" "(setq org-babel-confirm-evaluate-answer-no t)"
@@ -1380,19 +1377,6 @@ as the initial input for completion, and return that directory."
 
 ;;; Configure TeX
 
-(with-eval-after-load 'tex-mode
-  (add-hook 'latex-mode-hook #'electric-pair-local-mode)
-  (setq display-tex-shell-buffer-action
-        '(display-buffer-no-window
-          (allow-no-window . t))
-        tex-start-options "--synctex=1"
-        ;; latex-run-command "pdflatex"
-        )
-  (define-advice tex-terminate-paragraph (:around (fun &rest args) fill-and-indent)
-    (fill-paragraph)
-    (apply fun args)
-    (indent-according-to-mode)))
-
 (with-eval-after-load 'tex
   (setopt TeX-modes '(tex-mode plain-tex-mode latex-mode doctex-mode))
   (add-hook 'plain-TeX-mode-hook
@@ -1404,88 +1388,6 @@ as the initial input for completion, and return that directory."
   (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
   (add-hook 'LaTeX-mode-hook #'LaTeX-math-mode))
 
-;;; Track currency exchange rates
-
-(defvar esy/eur-to-ils-rates nil)
-(defvar esy/eur-to-ils-average-rate 0)
-
-(add-to-list 'savehist-additional-variables
-             'esy/eur-to-ils-rates)
-
-(defun esy/update-eur-to-ils-rate ()
-  (require 'dom)
-  (let* ((time (float-time))
-         (from "EUR")
-         (to "ILS")
-         (amount 1)
-         (url (url-parse-make-urlobj "https"
-                                     nil
-                                     nil
-                                     "www.x-rates.com"
-                                     nil
-                                     (concat "/calculator/?"
-                                             (url-build-query-string `(("from" ,from)
-                                                                       ("to" ,to)
-                                                                       ("amount" ,amount)))))))
-    (url-retrieve url
-                  (lambda (_)
-                    (goto-char (point-min))
-                    (search-forward "\n\n")
-                    (push (cons time
-                                (string-to-number (caddar (dom-by-class (libxml-parse-html-region (point))
-                                                                        "ccOutputRslt"))))
-                          esy/eur-to-ils-rates)
-                    (setq esy/eur-to-ils-average-rate
-                          (/ (round (* (apply #'+
-                                            (mapcar #'cdr
-                                                    (take 100
-                                                          esy/eur-to-ils-rates)))
-                                       10))
-                             1000.0)))
-                  nil t)))
-
-(run-at-time t 300 #'esy/update-eur-to-ils-rate)
-
-(defun esy/plot-eur-to-ils-rates (height width)
-  (require 'svg)
-  (let* ((svg (svg-create width height
-                          :stroke "green"))
-         (time (float-time))
-         (frame (* 60 60 24 7))
-         (data (named-let loop ((rates esy/eur-to-ils-rates)
-                                (acc nil)
-                                (min most-positive-fixnum)
-                                (max most-negative-fixnum))
-                 (if rates
-                     (let ((x (* (/ (+ frame (- (caar rates) time))
-                                    frame)
-                                 width)))
-                       (if (< 0 x)
-                           (let ((val (cdar rates)))
-                             (loop (cdr rates)
-                                   (cons (cons x (cdar rates)) acc)
-                                   (min val min)
-                                   (max val max)))
-                         (list acc min max)))
-                   (list acc min max))))
-         (points (nth 0 data))
-         (min (nth 1 data))
-         (max (nth 2 data))
-         (normalized-points (mapcar (lambda (xy)
-                                      (cons (car xy)
-                                            (- height (* height
-                                                         (/ (- (cdr xy) min)
-                                                            (- max min))))))
-                                    points)))
-    (svg-polyline svg normalized-points :fill-color "none")
-    (svg-image svg)))
-
-(defun esy/plot-eur-rates ()
-  (interactive)
-  (with-current-buffer-window "EUR to ILS" nil nil
-    (insert-image (esy/plot-eur-to-ils-rates 300 500))
-    (insert "\n")))
-
 (with-eval-after-load 'elisp-mode
   (setq elisp-flymake-byte-compile-load-path (cons "./" load-path)))