diff --git a/init.d/basics/global-variables.el b/init.d/basics/global-variables.el index 7d2b7b9..1117b31 100644 --- a/init.d/basics/global-variables.el +++ b/init.d/basics/global-variables.el @@ -1,6 +1,6 @@ ;;; global-variables.el --- Set some global variables. -*- lexical-binding: t; -*- -;; Time-stamp: <2020-02-26T22:56:29+0100> +;; Time-stamp: <2020-02-27T05:14:19+0100> ;;; Commentary: ;; * Set `slow-computer'. @@ -65,11 +65,6 @@ "Returns the version of clangd as float." (string-to-number (nth 2 (split-string (shell-command-to-string "clangd --version"))))) - - (defun my/file-last-modification (file) - "Return the absolute time FILE was last modified in seconds." - (time-to-seconds - (file-attribute-modification-time (file-attributes file)))) ) (provide 'basics/global-variables) diff --git a/init.d/basics/package-management.el b/init.d/basics/package-management.el index c707142..b1e59ac 100644 --- a/init.d/basics/package-management.el +++ b/init.d/basics/package-management.el @@ -1,6 +1,6 @@ ;;; package-management.el --- Initialize package management. -*- lexical-binding: t; -*- -;; Time-stamp: <2020-02-27T03:13:02+0100> +;; Time-stamp: <2020-02-27T05:25:23+0100> ;;; Commentary: ;; * Set up package sources and their priorities. @@ -38,9 +38,6 @@ (eval-when-compile (require 'use-package)) -;; We need `my/file-last-modification', it needs `use-package'. -(require 'basics/global-variables) - ;; Always install packages if they are not present. (use-package use-package :custom (use-package-always-ensure t) @@ -80,20 +77,21 @@ (quelpa-update-melpa-p nil) (quelpa-checkout-melpa-p nil)) :config - (defvar my/quelpa-last-upgrade-file - (concat user-emacs-directory "quelpa/last_upgrade") - "File with the timestamp of the last quelpa upgrade.") + (defun my/quelpa-upgrade-all-maybe (&optional force) + "Run `quelpa-upgrade-all' if at least 7 days passed since the last run. +With prefix FORCE, packages will all be upgraded discarding local changes." + (interactive "P") + (let ((timestamp (expand-file-name "last_upgrade" quelpa-dir)) + (days 7)) + (when (or (not (file-exists-p timestamp)) + (> (- (time-to-seconds) ; Current time - file modification time. + (time-to-seconds (nth 5 (file-attributes timestamp)))) + (* 60 60 24 days))) + (let ((current-prefix-arg force)) + (quelpa-upgrade-all)) + (write-region "" nil timestamp)))) - (defun my/quelpa-maybe-upgrade () - "Upgrade quelpa packages if the last upgrade was > 7 days ago." - (when (or (not (file-exists-p my/quelpa-last-upgrade-file)) - (> (- (time-to-seconds) - (my/file-last-modification my/quelpa-last-upgrade-file)) - (* 60 60 24 7))) - (quelpa-upgrade-all) - (write-region "" nil my/quelpa-last-upgrade-file))) - - :hook (after-init . my/quelpa-maybe-upgrade) + :hook (after-init . my/quelpa-upgrade-all-maybe) ) ;; Use :quelpa in use-package configurations. diff --git a/init.el b/init.el index 473463a..9e71588 100644 --- a/init.el +++ b/init.el @@ -1,6 +1,6 @@ ;;; init.el --- tastytea's Emacs init file. -*- lexical-binding: t; -*- -;; Time-stamp: <2020-02-26T23:31:10+0100> +;; Time-stamp: <2020-02-27T05:16:37+0100> ;;; Commentary: ;; Requires at least Emacs 26. Most of it will probably work with Emacs 24 and @@ -12,6 +12,7 @@ (push (concat user-emacs-directory "init.d") load-path) (require 'basics/package-management) + (require 'basics/global-variables) ;; Set garbage collection threshold to 100 MiB (or 20 MiB) to speed up init. diff --git a/server/server b/server/server index e594166..21934bd 100644 --- a/server/server +++ b/server/server @@ -1,2 +1,2 @@ -127.0.0.1:51313 10169 +127.0.0.1:51313 880 phahw2ohVoh0oopheish7IVie9desh8aequeenei3uo8wahShe%thuadaeNa4ieh \ No newline at end of file