Add Android functionality

master
trémeur 2 years ago
parent cd9c277a69
commit 0c96e9885c

@ -1,5 +1,11 @@
* Systems and custom functions
#+BEGIN_SRC emacs-lisp
(if (string-equal system-type "android")
(setq fileroot "/storage/emulated/0/Documents/")
(setq fileroot "~/Documents/drive/"))
#+END_SRC
Firstly, tell Emacs where to look for custom functions (via [[https://www.emacswiki.org/emacs/LoadingLispFiles][EmacsWiki]]).
#+BEGIN_SRC emacs-lisp
@ -9,27 +15,7 @@ Firstly, tell Emacs where to look for custom functions (via [[https://www.emacsw
(load-file (concat (file-name-as-directory dir) f)))))
(mapc load-it (directory-files dir nil "\\.el$"))))
(load-directory "~/.emacs.d/custom/")
(load-directory "~/Documents/drive/admin/emacs/custom/")
#+END_SRC
Define functions that specify what OS Im on, also whether Im at work or not. Then I can implement specific packages according to need/compatibility.
#+BEGIN_SRC emacs-lisp
(defun islin ()
"Return true if on linux"
(string-equal system-type "gnu/linux"))
(defun iswin ()
"Return true if on windows"
(string-equal system-type "windows-nt"))
(defun ismac () ;; unlikely now, but might as well keep this
"Return true if on macos"
(string-equal system-type "darwin"))
(defun atwork ()
"Return true if at work"
(string-equal user-login-name "3055822"))
(load-directory (concat (file-name-as-directory fileroot) "admin/emacs/custom/"))
#+END_SRC
* =$whoami=, a big neckbeard, thats who
@ -37,11 +23,11 @@ Define functions that specify what OS Im on, also whether Im at work or no
Set name and location based on who Im being right now.
#+BEGIN_SRC emacs-lisp
(if (atwork)
(load-file "~/Documents/drive/admin/emacs/identity-work.el")
(if (string-equal user-login-name "3055822")
(load-file (concat (file-name-as-directory fileroot) "admin/emacs/identity-work.el"))
(if workhours
(load-file "~/Documents/drive/admin/emacs/identity-work.el")
(load-file "~/Documents/drive/admin/emacs/identity-home.el")))
(load-file (concat (file-name-as-directory fileroot) "admin/emacs/identity-work.el"))
(load-file (concat (file-name-as-directory fileroot) "admin/emacs/identity-home.el"))))
#+END_SRC
* Sonic arts
@ -83,9 +69,10 @@ Make the +window+ /frame/ look nice and clean. Scroll bars behave pointlessly on
Make everything just a little tiny bit transparent unless Im using the boring Windows desktop.
#+BEGIN_SRC emacs-lisp
(unless (atwork)
(unless (string-equal system-type "android")
(unless (string-equal user-login-name "3055822")
(set-frame-parameter (selected-frame) 'alpha 95)
(add-to-list 'default-frame-alist '(alpha . 95)))
(add-to-list 'default-frame-alist '(alpha . 95))))
#+END_SRC
Stop creating all those =~= files everywhere. Put them somewhere that I can ignore them.
@ -158,7 +145,7 @@ Make new directories automatically (from [[https://emacsredux.com/blog/2022/06/1
On Linux, I have to tell Emacs to use Chrome for web links.
#+BEGIN_SRC emacs-lisp
(when (islin)
(when (string-equal system-type "gnu/linux")
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "google-chrome"))
#+END_SRC
@ -166,7 +153,7 @@ On Linux, I have to tell Emacs to use Chrome for web links.
Honestly I dont know if Ill ever use macOS again, but in case I do, I need the meta key to work.
#+BEGIN_SRC emacs-lisp
(when (ismac)
(when (string-equal system-type "darwin")
(setq ns-alternate-modifier 'meta)
(setq ns-right-alternate-modifier 'none))
#+END_SRC
@ -174,29 +161,33 @@ Honestly I dont know if Ill ever use macOS again, but in case I do, I need
Windows likes to set the default directory to the folder where the Emacs binary is stored, which it probably thinks is helpful, but is in fact Very Stupid.
#+BEGIN_SRC emacs-lisp
(when (iswin)
(when (string-equal system-type "windows-nt")
(setq default-directory "~/"))
#+END_SRC
Android has enormous issues with keybindings, so requiring =yes-or-no-p= where possible helps a bit.
#+BEGIN_SRC emacs-lisp
(when (string-equal system-type "android")
(defalias 'y-or-n-p 'yes-or-no-p))
#+END_SRC
* =use-package=
Set up package handling, including =use-package=. Some of the =org= tools I use are from Non-GNU ELPA, I think. Most of this is the standard =use-package= setup stuff.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(package-initialize)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("nongnu" . "https://elpa.nongnu.org/nongnu/"))
(setq package-check-signature nil)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package-ensure)
(setq use-package-always-ensure t)
(setq use-package-always-ensure t))
#+END_SRC
* Packages, modes, etc.
@ -205,10 +196,11 @@ Set up package handling, including =use-package=. Some of the =org= tools I use
I use BibLaTeX for better compatibility with accented characters and generally being more sensible.
#+BEGIN_SRC
(unless (string-equal system-type "android")
(use-package bibtex
:mode ("\\.bib" . bibtex-mode)
:config
(setq bibtex-dialect 'biblatex))
(setq bibtex-dialect 'biblatex)))
#+END_SRC
** =calibredb=
@ -216,7 +208,7 @@ I use BibLaTeX for better compatibility with accented characters and generally b
This may work only on Linux (it uses SQL???), but my ebooks are only on Linux so thats ok.
#+BEGIN_SRC emacs-lisp
(when (islin)
(when (string-equal system-type "gnu/linux")
(use-package calibredb
:defer t
:config
@ -234,14 +226,15 @@ This may work only on Linux (it uses SQL???), but my ebooks are only on Linux so
Let me search my journal files, not synced to my work computer. Set regexp search by default.
#+BEGIN_SRC emacs-lisp
(unless (atwork)
(unless (string-equal system-type "android")
(unless (string-equal user-login-name "3055822")
(use-package deft
:config
(setq deft-extensions '("org"))
(setq deft-directory "~/Documents/drive/org/journal")
(setq deft-current-sort-method 'title)
(setq deft-incremental-search nil)
(setq deft-recursive t)))
(setq deft-recursive t))))
#+END_SRC
** =dimmer=
@ -249,12 +242,13 @@ Let me search my journal files, not synced to my work computer. Set regexp searc
Dims inactive buffers. Adjustments for =modus-themes= as suggested.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package dimmer
:config
(setq dimmer-fraction 0.4)
(setq dimmer-adjustment-mode :foreground)
(setq dimmer-use-colorspace :rgb)
(dimmer-mode 1))
(dimmer-mode 1)))
#+END_SRC
** =doom-modeline=
@ -262,6 +256,7 @@ Dims inactive buffers. Adjustments for =modus-themes= as suggested.
Much nicer-looking modeline, and still my favourite over newer, trendier options. Last time I tried installing this from MELPA it made Emacs crash; I dont know if this is fixed yet.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package doom-modeline
:init
(doom-modeline-mode 1)
@ -270,7 +265,7 @@ Much nicer-looking modeline, and still my favourite over newer, trendier options
(setq doom-modeline-minor-modes t)
(setq doom-modeline-enable-word-count t)
(setq doom-modeline-continuous-word-count-modes '(markdown-mode gfm-mode))
(setq doom-modeline-buffer-encoding nil))
(setq doom-modeline-buffer-encoding nil)))
#+END_SRC
** =elfeed=
@ -278,15 +273,17 @@ Much nicer-looking modeline, and still my favourite over newer, trendier options
Obviously I use an =org= file to manage my feeds.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package elfeed-org
:config
(elfeed-org)
(setq rmh-elfeed-org-files (list "~/Documents/drive/org/feeds.org")))
(setq rmh-elfeed-org-files (list "~/Documents/drive/org/feeds.org"))))
#+END_SRC
Standard =elfeed= settings:
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(defun elfeed-load-db-and-open ()
"Load and open the elfeed DB"
(interactive)
@ -294,57 +291,54 @@ Standard =elfeed= settings:
(elfeed)
(elfeed-search-update--force)
(elfeed-update))
(global-set-key (kbd "C-x w") 'elfeed-load-db-and-open)
(defalias 'elfeed-toggle-star
(elfeed-expose #'elfeed-search-toggle-all 'star))
(eval-after-load 'elfeed-search
'(define-key elfeed-search-mode-map (kbd "m") 'elfeed-toggle-star))
(defun elfeed-save-db-and-bury ()
"Save and close the elfeed DB"
(interactive)
(elfeed-db-save)
(quit-window))
(use-package elfeed
:bind
(:map elfeed-search-mode-map
("q" . elfeed-save-db-and-bury))
:custom
(elfeed-sort-order 'ascending)
(elfeed-db-directory "~/Documents/drive/org/elfeed"))
(elfeed-db-directory "~/Documents/drive/org/elfeed")))
#+END_SRC
I am a huge supporter of big-endian date formats.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(defun elfeed-search-format-date (date)
"Set elfeed to display big-endian dates"
(format-time-string "%Y-%m-%d %H:%M" (seconds-to-time date)))
(format-time-string "%Y-%m-%d %H:%M" (seconds-to-time date))))
#+END_SRC
This apparently deletes really old entries from the database.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(add-hook 'elfeed-new-entry-hook
(elfeed-make-tagger :before "6 months ago"
:remove 'unread))
:remove 'unread)))
#+END_SRC
Save elfeed state properly when exiting Emacs.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(defun save-if-elfeed ()
"Save the elfeed DB if elfeed is running"
(if (get-buffer "*elfeed-search*")
(progn
(elfeed-db-save)
(message "Elfeed DB saved"))))
(add-hook 'kill-emacs-hook 'save-if-elfeed)
(add-hook 'kill-emacs-hook 'save-if-elfeed))
#+END_SRC
** =git-gutter=
@ -352,6 +346,7 @@ Save elfeed state properly when exiting Emacs.
Shows, or at least purports to show, =git diff= in the left margin if the file is being tracked by =git=.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package git-gutter
:config
(global-git-gutter-mode 1)
@ -360,14 +355,15 @@ Shows, or at least purports to show, =git diff= in the left margin if the file i
(set-face-foreground 'git-gutter:deleted "brown")
(setq git-gutter:added-sign "+"
git-gutter:modified-sign "×"
git-gutter:deleted-sign "-"))
git-gutter:deleted-sign "-")))
#+END_SRC
** =lastfm=
#+BEGIN_SRC emacs-lisp
(unless (atwork)
(use-package lastfm))
(unless (string-equal system-type "android")
(unless (string-equal user-login-name "3055822")
(use-package lastfm)))
#+END_SRC
** =markdown-mode=
@ -375,6 +371,7 @@ Shows, or at least purports to show, =git diff= in the left margin if the file i
I kind of hate markdown but I still have to use it sometimes.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package markdown-mode
:mode (("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode)
@ -386,7 +383,7 @@ I kind of hate markdown but I still have to use it sometimes.
:custom
(markdown-header-scaling t)
:custom-face
(markdown-header-face ((t (:inherit (default font-lock-function-name-face) :weight bold)))))
(markdown-header-face ((t (:inherit (default font-lock-function-name-face) :weight bold))))))
#+END_SRC
** =minions=
@ -394,9 +391,10 @@ I kind of hate markdown but I still have to use it sometimes.
Lists minor modes in a menu.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package minions
:config
(minions-mode))
(minions-mode)))
#+END_SRC
** =mu4e=
@ -404,7 +402,7 @@ Lists minor modes in a menu.
I really only use this for DW posts, but Im constantly surprised by how well it works. This package is the reason I cant upgrade to =emacs28=, because it doesnt currently seem to work; also, it uses =cl=, which is deprecated, hence suppressing warnings about it above.
#+BEGIN_SRC emacs-lisp
(when (islin)
(when (string-equal system-type "gnu/linux")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
(load-file "~/.emacs.d/mail.el")
(require 'mu4e)
@ -416,11 +414,12 @@ I really only use this for DW posts, but Im constantly surprised by how well
Show a nice filetree with icons. I use this much less often than I should.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package neotree
:init
(global-set-key [f8] 'neotree-toggle)
:config
(setq neo-theme (if (display-graphic-p) 'icons 'arrow)))
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))))
#+END_SRC
** =nov=
@ -428,7 +427,7 @@ Show a nice filetree with icons. I use this much less often than I should.
For reading ebooks. Only on Linux because I (supposedly) use it with my calibre library.
#+BEGIN_SRC emacs-lisp
(when (islin)
(when (string-equal system-type "gnu/linux")
(use-package nov
:init
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)))
@ -451,13 +450,14 @@ I want to indent under headings, I dont want pointless line breaks when text
(setq org-special-ctrl-a/e t)
#+END_SRC
Display images in =org= buffers. Ive increased the width to 500px because 300 was quite small.
Display images in =org= buffers. Ive increased the width to 500px because 300 was quite small. Im assuming this doesnt work on mobile, but why?
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(setq org-display-inline-images t)
(setq org-redisplay-inline-images t)
(setq org-startup-with-inline-images "inlineimages")
(setq org-image-actual-width '(500))
(setq org-image-actual-width '(500)))
#+END_SRC
Load the common agenda settings, i.e. those that I use in conky as well.
@ -484,14 +484,16 @@ Track when I complete todos.
This can set certain headlines not to be exported. I havent used it yet but it sounds useful.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package org-contrib)
(require 'ox-extra)
(ox-extras-activate '(ignore-headlines))
(ox-extras-activate '(ignore-headlines)))
#+END_SRC
Add a couple of classes for LaTeX export.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(add-to-list 'org-latex-classes
'("article-std"
"\\documentclass{article}
@ -509,7 +511,7 @@ Add a couple of classes for LaTeX export.
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))))
#+END_SRC
Settings for export, mostly for DW post previews but also fic?? And work I guess, I do that sometimes.
@ -522,7 +524,8 @@ Settings for export, mostly for DW post previews but also fic?? And work I guess
(setq org-export-with-creator nil)
(setq org-export-with-toc nil)
(setq org-export-time-stamp-file nil)
(if (atwork)
(unless (string-equal system-type "android")
(if (string-equal user-login-name "3055822")
(progn
(setq org-export-with-author nil)
(setq org-latex-default-class "article-std"))
@ -531,7 +534,7 @@ Settings for export, mostly for DW post previews but also fic?? And work I guess
(setq org-export-with-author nil)
(setq org-latex-default-class "article-std"))
(setq org-latex-default-class "memoir")))
(setq org-latex-compiler "xelatex")
(setq org-latex-compiler "xelatex"))
(setq org-html-validation-link nil)
(setq org-html-doctype "html5")
#+END_SRC
@ -543,14 +546,18 @@ Export non-breaking spaces properly; from, believe it or not, [[https://orgmode.
"Keep non-breaking spaces in HTML org export"
(when (org-export-derived-backend-p backend 'html)
(replace-regexp-in-string " " " " text)))
(add-to-list 'org-export-filter-plain-text-functions
(if (string-equal system-type "android")
(setq org-export-filter-plain-text-functions
'my-html-filter-nobreaks)
(add-to-list 'org-export-filter-plain-text-functions
'my-html-filter-nobreaks))
(unless (string-equal system-type "android")
(defun my-latex-filter-nobreaks (text backend info)
"Keep non-breaking spaces in LaTeX org export"
(when (org-export-derived-backend-p backend 'latex)
(replace-regexp-in-string " " "~" text)))
(add-to-list 'org-export-filter-plain-text-functions
'my-latex-filter-nobreaks)
'my-latex-filter-nobreaks))
#+END_SRC
*** Packages
@ -560,7 +567,8 @@ Export non-breaking spaces properly; from, believe it or not, [[https://orgmode.
Let properties be inherited by subheadings. I use this a lot for =:LOCATION:= on recurring events.
#+BEGIN_SRC emacs-lisp
(use-package org-agenda-property)
(unless (string-equal system-type "android")
(use-package org-agenda-property))
#+END_SRC
**** =org-journal=
@ -568,7 +576,8 @@ Let properties be inherited by subheadings. I use this a lot for =:LOCATION:= on
Automate a tiny part of something I was previously doing manually.
#+BEGIN_SRC emacs-lisp
(unless (atwork)
(unless (string-equal system-type "android")
(unless (string-equal user-login-name "3055822")
(defun org-journal-file-header-func (time)
"Set the header for org-journal files"
(concat "<" (format-time-string "%Y-%m-%d %a") ">\n\n"))
@ -581,7 +590,7 @@ Automate a tiny part of something I was previously doing manually.
(setq org-journal-find-file 'find-file)
(setq org-journal-date-format "journal")
(setq org-journal-time-format "%H:%M\n")
(setq org-journal-file-header 'org-journal-file-header-func)))
(setq org-journal-file-header 'org-journal-file-header-func))))
#+END_SRC
**** =org-modern=
@ -589,11 +598,12 @@ Automate a tiny part of something I was previously doing manually.
Use =org-modern=. [[https://github.com/minad/org-modern/issues/5#issuecomment-1318003940][Fix for issue with table widths]].
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package org-modern
:hook
(org-mode . org-modern-mode))
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
(custom-set-variables '(org-modern-table nil))
(custom-set-variables '(org-modern-table nil)))
#+END_SRC
**** =org-noter=
@ -601,10 +611,11 @@ Use =org-modern=. [[https://github.com/minad/org-modern/issues/5#issuecomment-13
RIP =interleave=, but this does ok as a replacement.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package org-noter
:config
(setq org-noter-property-doc-file "INTERLEAVE_PDF"
org-noter-property-note-location "INTERLEAVE_PAGE_NOTE"))
org-noter-property-note-location "INTERLEAVE_PAGE_NOTE")))
#+END_SRC
**** =org-sidebar=
@ -612,9 +623,10 @@ RIP =interleave=, but this does ok as a replacement.
Display the file outline in a sidebar.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package org-sidebar
:bind
("C-c C-x s" . org-sidebar-tree))
("C-c C-x s" . org-sidebar-tree)))
#+END_SRC
**** =org-wc=
@ -622,9 +634,10 @@ Display the file outline in a sidebar.
Display word counts next to org headings.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package org-wc
:bind
("C-c C-x w" . org-wc-display))
("C-c C-x w" . org-wc-display)))
#+END_SRC
*** Agenda settings
@ -641,9 +654,14 @@ Set the keybinding, set the week to start on Monday because Im not the Univer
Set the files to be included.
#+BEGIN_SRC emacs-lisp
(if (string-equal system-type "android")
(if workhours
(setq org-agenda-files '("/storage/emulated/0/Documents/org/calendar/admin.org" "/storage/emulated/0/Documents/org/calendar/music.org" "/storage/emulated/0/Documents/org/calendar/work.org"))
(setq org-agenda-files '("/storage/emulated/0/Documents/org/calendar/admin.org" "/storage/emulated/0/Documents/org/calendar/music.org" "/storage/emulated/0/Documents/org/calendar/personal.org")))
(progn
(add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/music.org")
(add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/admin.org")
(if (atwork)
(if (string-equal user-login-name "3055822")
(progn
(add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/work.org")
(add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/acwri.org"))
@ -655,7 +673,7 @@ Set the files to be included.
(add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/acwri.org"))
(progn
(add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/personal.org")
(add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/habit.org")))))
(add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/habit.org")))))))
#+END_SRC
Set how the agenda looks.
@ -682,26 +700,26 @@ Add period information to the agenda header (this has a very weird output, compl
Use a horizontal line to divide each day from the next.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(setq org-agenda-format-date (lambda (date) (concat "\n"
(make-string (window-width) 9472)
"\n"
(org-agenda-format-date-aligned date))))
(org-agenda-format-date-aligned date)))))
#+END_SRC
Set up habit display.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(add-to-list 'org-modules 'org-habit t)
(setq org-habit-show-all-today t)
(setq org-habit-show-all-today t))
#+END_SRC
** =paren=
Highlights matching bracket.
#+BEGIN_SRC emacs-lisp
(use-package paren
:config
(show-paren-mode +1))
(show-paren-mode +1)
#+END_SRC
** =pdf-tools= and =doc-view=
@ -709,7 +727,8 @@ Highlights matching bracket.
Use the superior package for viewing PDFs on the superior operating system, and use a less reliable one otherwise. Ghostscript has to be installed on Windows, but its indispensable anyway.
#+BEGIN_SRC emacs-lisp
(if (iswin)
(unless (string-equal system-type "android")
(if (string-equal system-type "windows-nt")
(use-package doc-view
:config
(setq doc-view-ghostscript-program "gswin32c"))
@ -718,7 +737,7 @@ Use the superior package for viewing PDFs on the superior operating system, and
(pdf-tools-install)
(define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward)
(add-hook 'pdf-view-mode-hook (lambda () (cua-mode 0)))
(setq pdf-view-resize-factor 1.1)))
(setq pdf-view-resize-factor 1.1))))
#+END_SRC
** =recentf=
@ -726,8 +745,6 @@ Use the superior package for viewing PDFs on the superior operating system, and
Gives me a dialog with recently opened files. Package management and =elfeed= stuff have to be manually excluded for obvious reasons. Surely I dont have to call =add-to-list= separately every time, but I havent found a more sensible way of doing it.
#+BEGIN_SRC emacs-lisp
(use-package recentf
:config
(recentf-mode 1)
(setq recentf-max-menu-items 20)
(setq recentf-max-saved-items 20)
@ -737,7 +754,7 @@ Gives me a dialog with recently opened files. Package management and =elfeed= st
(add-to-list 'recentf-exclude
(expand-file-name "~/.emacs.d/bookmarks"))
(add-to-list 'recentf-exclude
(expand-file-name "~/Documents/drive/org/elfeed/*")))
(expand-file-name "~/Documents/drive/org/elfeed/*"))
#+END_SRC
** =tex=
@ -745,6 +762,7 @@ Gives me a dialog with recently opened files. Package management and =elfeed= st
As previously described, “the big boy”. I know little about most of these settings, but I think theyre the default ones.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package tex
:ensure auctex
:mode ("\\.tex\\'" . latex-mode)
@ -759,7 +777,7 @@ As previously described, “the big boy”. I know little about most of these se
(setq-default TeX-engine 'xetex)
(setq-default TeX-PDF-mode t)
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
TeX-source-correlate-start-server t))
TeX-source-correlate-start-server t)))
#+END_SRC
** =typo=
@ -767,6 +785,7 @@ As previously described, “the big boy”. I know little about most of these se
Automatically use smart quotes. (Cant be set to =text-mode-hook=, unfortunately, as this messes things up in LaTeX; but the only other text-modes I use are =org= and Markdown, I think.) Also, best to /unset/ this mode in source blocks in =org=, [[https://emacs.stackexchange.com/questions/55944/disable-minor-mode-inside-source-blocks][hook taken from here]].
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package typo
:custom
(typo-global-mode 1)
@ -776,7 +795,7 @@ Automatically use smart quotes. (Cant be set to =text-mode-hook=, unfortunate
(defun unsmart-hook ()
"Turn off smart quotes for source blocks within org mode"
(add-hook 'typo-disable-electricity-functions 'org-in-src-block-p nil :local))
(add-hook 'org-mode-hook 'unsmart-hook)
(add-hook 'org-mode-hook 'unsmart-hook))
#+END_SRC
** =web-mode=
@ -784,6 +803,7 @@ Automatically use smart quotes. (Cant be set to =text-mode-hook=, unfortunate
This is good for auto indentation, folding, killing elements, apparently XPath?? but Ive failed to make faces work like they do in normal =html-mode=.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package web-mode
:mode (("\\.html?\\'" . web-mode)
("\\.css" . web-mode))
@ -793,7 +813,7 @@ This is good for auto indentation, folding, killing elements, apparently XPath??
(setq web-mode-enable-html-entities-fontification t)
(setq web-mode-enable-current-element-highlight t)
:bind
("C-c /" . web-mode-element-close))
("C-c /" . web-mode-element-close)))
#+END_SRC
** =yasnippet=
@ -801,10 +821,11 @@ This is good for auto indentation, folding, killing elements, apparently XPath??
Per-mode text expansion. What a lifechanger.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package yasnippet
:config
(setq yas-snippet-dirs '("~/.emacs.d/snippets")))
(yas-global-mode 1)
(yas-global-mode 1))
#+END_SRC
* Aesthetics
@ -816,11 +837,12 @@ Per-mode text expansion. What a lifechanger.
Shows nice icons in the modeline and in =neotree=. Fonts need to be installed manually on Windows, possibly because of permissions issues or because of where the Emacs binary lives or maybe both those things.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package all-the-icons
:config
(unless (iswin)
(unless (string-equal system-type "windows-nt")
(when (not (member "all-the-icons" (font-family-list)))
(all-the-icons-install-fonts t))))
(all-the-icons-install-fonts t)))))
#+END_SRC
*** =emojify=
@ -828,10 +850,11 @@ Shows nice icons in the modeline and in =neotree=. Fonts need to be installed ma
Support for various types of emoge.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package emojify
:hook
(text-mode . emojify-mode)
(org-agenda-mode . emojify-mode))
(org-agenda-mode . emojify-mode)))
#+END_SRC
*** =hl-line=
@ -839,22 +862,20 @@ Support for various types of emoge.
Highlights current line.
#+BEGIN_SRC emacs-lisp
(use-package hl-line
:config
(global-hl-line-mode 1))
(global-hl-line-mode 1)
#+END_SRC
** Theme/colours
Set a theme from =modus-themes=.
Set a theme from =modus-themes=. This is built in for version 28 and above.
#+BEGIN_SRC emacs-lisp
(use-package modus-themes
:config
(unless (string-equal system-type "android")
(use-package modus-themes))
(setq modus-themes-bold-constructs t)
(setq modus-themes-italic-constructs t)
(setq modus-themes-mixed-fonts t)
(setq modus-themes-org-blocks 'gray-background))
(setq modus-themes-org-blocks 'gray-background)
(load-theme 'modus-operandi-tinted t)
#+END_SRC
@ -863,7 +884,8 @@ Set a theme from =modus-themes=.
Use Noto fonts to match my system fonts on Linux. This has to be done differently on Windows for some reason.
#+BEGIN_SRC emacs-lisp
(if (iswin)
(unless (string-equal system-type "android")
(if (string-equal system-type "windows-nt")
(custom-set-faces
'(default ((t (:family "Noto Mono" :foundry "outline" :slant normal :weight normal :height 98 :width normal))))
'(italic ((t (:slant italic))))
@ -873,17 +895,18 @@ Use Noto fonts to match my system fonts on Linux. This has to be done differentl
'(italic ((t (:slant italic))))
'(variable-pitch ((t (:family "Noto Sans" :height 90))))
'(fixed-pitch ((t (:family "Noto Mono" :height 100))))
'(modus-themes-fixed-pitch ((t (:family "Noto Mono" :height 100))))))
'(modus-themes-fixed-pitch ((t (:family "Noto Mono" :height 100)))))))
#+END_SRC
Use the =mixed-pitch= package to determine the font intelligently in modes that contain both text and prog elements.
#+BEGIN_SRC emacs-lisp
(unless (string-equal system-type "android")
(use-package mixed-pitch
:hook
(LaTeX-mode . mixed-pitch-mode)
(org-mode . mixed-pitch-mode)
(markdown-mode . mixed-pitch-mode))
(markdown-mode . mixed-pitch-mode)))
#+END_SRC
* Startup

@ -41,6 +41,7 @@
(with-current-buffer oldname
(delete-file newname)))
(unless (string-equal system-type "android")
(defun dwsecurity ()
"Set security level for DW post"
(setq security (completing-read-multiple "Security (public, access, private): " '("public" "access" "private")))
@ -52,8 +53,9 @@
(let* ((securityjunk
(format "%S" security))
(end (- (length securityjunk) 2)))
(substring securityjunk 2 end))"\n"))))
(substring securityjunk 2 end))"\n")))))
(unless (string-equal system-type "android")
(defun dwmood ()
"Set mood for DW post"
(setq mood (completing-read-multiple "Mood: " '("accomplished" "aggravated" "amused" "angry" "annoyed" "anxious" "apathetic" "artistic" "awake" "bitchy" "blah" "blank" "bored" "bouncy" "busy" "calm" "cheerful" "chipper" "cold" "complacent" "confused" "contemplative" "content" "cranky" "crappy" "crazy" "creative" "crushed" "curious" "cynical" "depressed" "determined" "devious" "dirty" "disappointed" "discontent" "distressed" "ditzy" "dorky" "drained" "drunk" "ecstatic" "embarrassed" "energetic" "enraged" "enthralled" "envious" "exanimate" "excited" "exhausted" "flirty" "frustrated" "full" "geeky" "giddy" "giggly" "gloomy" "good" "grateful" "groggy" "grumpy" "guilty" "happy" "high" "hopeful" "horny" "hot" "hungry" "hyper" "impressed" "indescribable" "indifferent" "infuriated" "intimidated" "irate" "irritated" "jealous" "jubilant" "lazy" "lethargic" "listless" "lonely" "loved" "melancholy" "mellow" "mischievous" "moody" "morose" "naughty" "nauseated" "nerdy" "nervous" "nostalgic" "numb" "okay" "optimistic" "peaceful" "pensive" "pessimistic" "pissed off" "pleased" "predatory" "productive" "quixotic" "recumbent" "refreshed" "rejected" "rejuvenated" "relaxed" "relieved" "restless" "rushed" "sad" "satisfied" "scared" "shocked" "sick" "silly" "sleepy" "sore" "stressed" "surprised" "sympathetic" "thankful" "thirsty" "thoughtful" "tired" "touched" "uncomfortable" "weird" "working" "worried")))
@ -65,8 +67,9 @@
(let* ((moodjunk
(format "%S" mood))
(end (- (length moodjunk) 2)))
(substring moodjunk 2 end))"\n"))))
(substring moodjunk 2 end))"\n")))))
(unless (string-equal system-type "android")
(defun dwmusic ()
"Set current music for DW post"
(setq music (lastfm-user-get-recent-tracks :user lastfm-user :from 1 :to 1))
@ -80,8 +83,9 @@
(let* ((musicjunk
(format "%S" music))
(end (- (length musicjunk) 4)))
(substring musicjunk 4 end))"\n"))))
(substring musicjunk 4 end))"\n")))))
(unless (string-equal system-type "android")
(defun dwicon (thefile)
"Set icon for DW post"
(setq icon "skip")
@ -90,22 +94,25 @@
(iconchoose))
(if (equal icon "skip")
(sleep-for 0)
(insert (concat "post-icon: "icon "\n"))))
(insert (concat "post-icon: "icon "\n")))))
(unless (string-equal system-type "android")
(defun dwlocation ()
"Set location for DW post"
(setq location (read-string "Location: " dw-defaultlocation))
(if (equal location "")
(sleep-for 0)
(insert (concat "post-location: " location "\n"))))
(insert (concat "post-location: " location "\n")))))
(unless (string-equal system-type "android")
(defun dwmusic-manual ()
"Set current music for DW post if lastfm.el not set up"
(setq music (read-string "Music: "))
(if (equal music "")
(sleep-for 0)
(insert (concat "post-music: " music "\n"))))
(insert (concat "post-music: " music "\n")))))
(unless (string-equal system-type "android")
(defun dw-posted ()
"Log DW post"
(find-file-noselect "~/Documents/drive/org/calendar/habit.org")
@ -113,9 +120,10 @@
(goto-char (point-min))
(re-search-forward "RECUR dw posts")
(org-shiftright)
(sleep-for 1)
(save-buffer)))
(sleep-for 4)
(save-buffer))))
(unless (string-equal system-type "android")
(defun dwpost (psubject tags)
"Post to DW"
(interactive (list (read-string "Post title (REQUIRED): ")
@ -138,4 +146,4 @@
(kill-buffer (concat "*sent mail to " dw-username "*"))
(with-current-buffer oldname
(delete-file newname))
(dw-posted))
(dw-posted)))

@ -44,6 +44,7 @@
(with-current-buffer oldname
(delete-file newname)))
(unless (string-equal system-type "android")
(defun fic-export ()
"Export fic to HTML, EPUB, PDF"
(interactive)
@ -239,4 +240,4 @@
(if (file-exists-p "texput.log")
(delete-file "texput.log"))
(delete-file texfile))
(message "Done"))
(message "Done")))

@ -1,6 +1,7 @@
(setq periodfile (concat (file-name-as-directory fileroot) "admin/emacs/period.org"))
(defun periodise ()
"Return day of menstrual cycle"
(setq periodfile "~/Documents/drive/admin/emacs/period.org")
(find-file-noselect periodfile)
(setq thebuffer (file-name-nondirectory periodfile))
(with-current-buffer thebuffer
@ -20,7 +21,6 @@
(defun menstruate ()
"Mark beginning of menstrual cycle"
(interactive)
(setq periodfile "~/Documents/drive/admin/emacs/period.org")
(find-file-noselect periodfile)
(setq thebuffer (file-name-nondirectory periodfile))
(with-current-buffer thebuffer

@ -1,4 +1,6 @@
(load-file "~/Documents/drive/admin/emacs/daysoff.el")
(if (string-equal system-type "android")
(load-file "/storage/emulated/0/Documents/admin/emacs/daysoff.el")
(load-file "~/Documents/drive/admin/emacs/daysoff.el"))
(defcustom workday nil
"Returns true on working days"

Loading…
Cancel
Save