From: Eshel Yaron Date: Mon, 24 Oct 2022 13:37:52 +0000 (+0300) Subject: Add important advice for sql-comint-postgres X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=610b3b95d698aea45ca60ee32bc59d9374ef9f1f;p=dotfiles.git Add important advice for sql-comint-postgres --- diff --git a/.emacs.d/esy.org b/.emacs.d/esy.org index ef21ee0..65b06e6 100644 --- a/.emacs.d/esy.org +++ b/.emacs.d/esy.org @@ -142,7 +142,7 @@ For further information about Elisp headers, see [[info:elisp#Library (setq ef-themes-mixed-fonts t ef-themes-variable-pitch-ui t - ef-themes-to-toggle '(ef-bio ef-frost)) + ef-themes-to-toggle '(ef-bio ef-summer)) (mapc #'disable-theme custom-enabled-themes) (load-theme 'ef-bio :no-confirm) #+end_src @@ -177,7 +177,9 @@ For further information about Elisp headers, see [[info:elisp#Library no-littering ns-auto-titlebar ob-prolog olivetti orderless org-modern paredit pdf-tools rainbow-delimiters rg slack smtpmail-multi tramp typit vterm vundo which-key - whitespace-cleanup-mode yaml-mode)) + whitespace-cleanup-mode yaml-mode) + package-archive-column-width 12 + package-version-column-width 28) (package-install-selected-packages) #+end_src @@ -258,9 +260,46 @@ For a list of available frame parameters, see [[info:elisp#Frame Parameters][eli #+begin_src emacs-lisp (add-to-list 'initial-frame-alist '(fullscreen . fullboth)) - (add-to-list 'initial-frame-alist '(font . "Iosevka-13")) + ;; (add-to-list 'initial-frame-alist '(font . "Iosevka-13")) +#+end_src + +** Font configurations + +Trying out Prot's ~fontaine~ package for font configuration. + +#+begin_src emacs-lisp + (require 'fontaine) + + (setq fontaine-presets + '((regular + :default-height 130) + (large + :default-weight semilight + :default-height 170 + :bold-weight extrabold) + (t + ;; I keep all properties for didactic purposes, but most can be + ;; omitted. + :default-family "Iosevka" + :default-weight regular + :default-height 130 + :fixed-pitch-family nil ; falls back to :default-family + :fixed-pitch-weight nil ; falls back to :default-weight + :fixed-pitch-height 1.0 + :fixed-pitch-serif-family nil ; falls back to :default-family + :fixed-pitch-serif-weight nil ; falls back to :default-weight + :fixed-pitch-serif-height 1.0 + :variable-pitch-family "Iosevka Etoile" + :variable-pitch-weight nil + :variable-pitch-height 1.0 + :bold-family nil ; use whatever the underlying face has + :bold-weight bold + :italic-family nil + :italic-slant italic + :line-spacing nil))) + + (fontaine-set-preset 'regular) #+end_src - ** Must have display settings :PROPERTIES: :CUSTOM_ID: display-must-haves @@ -285,7 +324,7 @@ For a list of available frame parameters, see [[info:elisp#Frame Parameters][eli (put 'suspend-frame 'disabled t) #+end_src -** Variable-pitch font +** COMMENT Variable-pitch font :PROPERTIES: :CUSTOM_ID: variable-pitch-font :END: @@ -294,7 +333,7 @@ For a list of available frame parameters, see [[info:elisp#Frame Parameters][eli (set-face-font 'variable-pitch "Iosevka Etoile-13") #+end_src -** Fixed-pitch font +** COMMENT Fixed-pitch font :PROPERTIES: :CUSTOM_ID: fixed-pitch-font :END: @@ -409,6 +448,7 @@ For a list of available frame parameters, see [[info:elisp#Frame Parameters][eli org-log-into-drawer t org-use-fast-todo-selection 'expert org-clock-in-switch-to-state "INPROGRESS") + (add-to-list 'org-src-lang-modes '("prolog" . sweeprolog)) (keymap-unset org-mode-map "C-," t)) #+end_src @@ -786,11 +826,12 @@ refiling directly into deeper headings as well. :END: #+begin_src emacs-lisp - (keymap-global-set "C-c p" sweeprolog-prefix-map) + (with-eval-after-load 'sweeprolog + (keymap-global-set "C-c p" sweeprolog-prefix-map)) (keymap-global-set "C-c w" #'esy/eww) (keymap-global-set "C-c c" #'org-capture) (keymap-global-set "C-c l" #'org-store-link) - (keymap-global-set "C-c j" #'org-agenda) + (keymap-global-set "C-c a" #'org-agenda) (keymap-global-set "C-c !" #'consult-flymake) (keymap-global-set "C-c E" #'elfeed) (keymap-global-set "C-c G" #'gnus) @@ -1034,7 +1075,12 @@ over ssh for remote connections. "https://cestlaz.github.io/rss.xml" "https://drewdevault.com/blog/index.xml" "https://xkcd.com/rss.xml" + "https://parasurv.neocities.org/rss.xml" + "https://writer13.neocities.org/rss.xml" + "https://njoseph.me/shaarli/feed/atom?" + "https://stephanango.com/feed.xml" "https://hnrss.org/newest?points=50" + "https://nullprogram.com/feed/" "https://planet.emacslife.com/atom.xml"))) #+end_src @@ -1769,8 +1815,13 @@ without asking each time. :CUSTOM_ID: logos :END: #+begin_src emacs-lisp + (defun esy/logos-set-fonts () + (if logos-focus-mode + (fontaine-set-preset 'large) + (fontaine-set-preset 'regular))) + (defun esy/logos-focus () - "Toggle settings for focused display with `logus-focus-mode'. + "Toggle settings for focused display with `logos-focus-mode'. This function in intended to be used as a member of `logos-focus-mode-extra-functions'." (when (eq major-mode 'org-mode) @@ -1779,8 +1830,6 @@ without asking each time. (logos--mode 'org-indent-mode -1) (logos--mode 'org-modern-mode 1)) (logos--set 'cursor-type 'hbar) - (logos--set 'text-scale-mode-amount 4) - (logos--mode 'text-scale-mode 1) (logos--mode 'display-line-numbers-mode -1) (logos--mode 'global-hl-line-mode -1) (logos--mode 'diff-hl-mode -1) @@ -1801,7 +1850,10 @@ without asking each time. (add-hook 'logos-focus-mode-extra-functions #'esy/logos-focus) - (add-hook 'logos-focus-mode-extra-functions #'delete-other-windows)) + (add-hook 'logos-focus-mode-extra-functions #'delete-other-windows) + + (with-eval-after-load 'fontaine + (add-hook 'logos-focus-mode-hook #'esy/logos-set-fonts))) (defun esy/present-buffer () "Toggle `logos-focus-mode' in the current buffer." @@ -1941,7 +1993,8 @@ and friends work correctly with ~consult~ enabled completions. #+begin_src emacs-lisp (with-eval-after-load 'xref (setq xref-show-definitions-function #'consult-xref - xref-show-xrefs-function #'consult-xref)) + xref-show-xrefs-function #'consult-xref + xref-search-program 'ripgrep)) #+end_src ** Show the time in Amsterdam in =world-clock= @@ -2016,6 +2069,8 @@ Add the timezones of places of interest to the list of clocks shown by (with-eval-after-load 'sql (setq sqlformat-command 'pgformatter) (define-key sql-mode-map (kbd "C-c C-f") 'sqlformat) + (setq sql-input-ring-file-name (expand-file-name ".sqli-history" + no-littering-var-directory)) (setq sql-connection-alist (let* ((a (auth-source-search :port 5432 :max 3 @@ -2037,13 +2092,20 @@ Add the timezones of places of interest to the list of clocks shown by (sql-password ,(funcall (plist-get p :secret))) (sql-server ,(plist-get p :host)) (sql-database "alerts")) - (cfg + (cgs (sql-product 'postgres) (sql-user ,(plist-get c :user)) (sql-port 5432) (sql-password ,(funcall (plist-get c :secret))) (sql-server ,(plist-get c :host)) - (sql-database "container_graph")))))) + (sql-database "container_graph"))))) + + (define-advice sql-comint-postgres (:around (fun &rest args) use-sql-password) + (let ((process-environment + (nconc + (list (format "PGPASSWORD=%s" sql-password)) + process-environment))) + (apply fun args)))) #+end_src * Elisp Footer