Skip to content

Instantly share code, notes, and snippets.

Avatar
😷

Ag Ibragimov agzam

😷
View GitHub Profile
@agzam
agzam / log
Last active Feb 9, 2021
clojure-lsp GraalVM build failing
View log
clojure-lsp on  master via ☕ v11.0.10 at 23:00:01 ❯ ./graalvm/native-unix-compile.sh
Picked up JAVA_TOOL_OPTIONS: -Dapple.awt.UIElement=true
OpenJDK 64-Bit Server VM warning: forcing TieredStopAtLevel to full optimization because JVMCI is enabled
Picked up JAVA_TOOL_OPTIONS: -Dapple.awt.UIElement=true
Compiling 1 source files to /Users/ag/sandbox/clojure-lsp/target/classes
Picked up JAVA_TOOL_OPTIONS: -Dapple.awt.UIElement=true
Compiling clojure-lsp.clojure-core
Compiling clojure-lsp.crawler
Compiling clojure-lsp.db
Compiling clojure-lsp.feature.call-hierarchy
@agzam
agzam / zathura-client.org
Last active Jan 29, 2021
Open pdf files with Zathura on Mac
View zathura-client.org

Zathura on Mac

I want to open PDF files with Zathura on Mac. Problem is - Zathura does not have a proper App Bundle. So you cannot go in Finder to a pdf file, navigate to ‘Get Info’ and set pdf files to be opened with Zathura.

Luckily, you can create a custom App Bundle that wraps up a script that does that

But that is not as straightforward as you think it is, you can’t just execute a shell script. What if the file already opened with one of the instances of zathura process? Since Zathura is not a native OSX app, it will create a new process instance every time you open it.

The following script opens a file in Zathura, and if it was already opened, it would only activate the right window.

How to use it

@agzam
agzam / funcs.el
Created Oct 10, 2020
Find a message in a mailing list
View funcs.el
(defun mu4e-action-find-in-mailing-list (msg)
"Find message in mailing-list archives"
(interactive)
(let* ((mlist (mu4e-message-field msg :mailing-list))
(msg-id (mu4e-message-field msg :message-id))
(url
(pcase mlist
;; gnu.org
((pred (lambda (x) (string-suffix-p "gnu.org" x)))
@agzam
agzam / toggle-frame-maximized-undecorated.el
Last active Aug 28, 2020
Emacs undecorated (title-less) frame in OSX
View toggle-frame-maximized-undecorated.el
(defun toggle-frame-maximized-undecorated ()
(interactive)
(let* ((frame (selected-frame))
(on? (and (frame-parameter frame 'undecorated)
(eq (frame-parameter frame 'fullscreen) 'maximized)))
(geom (frame-monitor-attribute 'geometry))
(x (nth 0 geom))
(y (nth 1 geom))
(display-height (nth 3 geom))
(display-width (nth 2 geom))
@agzam
agzam / diff-last-two-kills.el
Last active Jul 27, 2020
Diff last couple of things in the kill ring
View diff-last-two-kills.el
(defun diff-last-two-kills (&optional ediff?)
"Diff last couple of things in the kill-ring. With prefix open ediff."
(interactive "P")
(let* ((old "/tmp/old-kill")
(new "/tmp/new-kill")
(prev-ediff-quit-hook ediff-quit-hook))
(cl-flet ((kill-temps
()
(dolist (f (list old new))
(kill-buffer (find-buffer-visiting f)))
@agzam
agzam / custom-org-insert-link.org
Last active Jun 30, 2020
Customize org-insert-link
View custom-org-insert-link.org
@agzam
agzam / ibuffer-unsaved-files.el
Last active Mar 27, 2020
Custom iBuffer filter for unsaved buffers
View ibuffer-unsaved-files.el
(define-ibuffer-filter unsaved-file-buffers
"Toggle current view to buffers whose file is unsaved."
(:description "file is unsaved")
(ignore qualifier)
(and (buffer-local-value 'buffer-file-name buf)
(buffer-modified-p buf)))
(define-key ibuffer-mode-map (kbd "/ u") #'ibuffer-filter-by-unsaved-file-buffers)
@agzam
agzam / find-message.el
Last active Jun 30, 2020
Mu4e action to find a message in mailing list archives
View find-message.el
;; If you subscribed to mailing list(s) in gnu.org or googlegroups.com
;; and using mu4e as your mailing app, very often you need to
;; find a message in lists.gnu.org/archive or googlegroups.com
;;
;; For example, when you don't have the context of a particular thread
;; and all prior messages got deleted locally.
;;
;; This mu4e action allows you
;; to quickly find selected email post in the archive
;; and open in the browser
@agzam
agzam / toggle-frame-maximized-undecorated.el
Last active Dec 18, 2019
Maximized undecorated (title-less) Emacs frame with no gaps around
View toggle-frame-maximized-undecorated.el
(defun toggle-frame-maximized-undecorated ()
(interactive)
(let* ((frame (selected-frame))
(on? (and (frame-parameter frame 'undecorated)
(eq (frame-parameter frame 'fullscreen) 'maximized)))
(geom (frame-monitor-attribute 'geometry))
(x (first geom))
(y (second geom))
(display-height (first (last geom))))
(if on?
@agzam
agzam / diff-buffers.el
Last active Jun 30, 2020
Diff two buffers
View diff-buffers.el
(defun diff-buffers (buffer-A buffer-B)
"Diff two buffers."
(interactive
(let* ((only-two? (eq 2 (count-windows)))
(wins (sort (window-list)
(lambda (a b) (< (window-use-time a)
(window-use-time b)))))
(b1 (if only-two?
(window-buffer (first wins))
(read-buffer "Buffer A to compare")))