From 6e68f800d23cfad6223b2666f427d09d2868b255 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Mon, 2 Jun 2025 05:49:33 +0200 Subject: Update emacs config and lua-mode --- .emacs | 34 ++++++++++++++++++++++++++++++++-- .emacs.d/lisp/lua-mode.el | 28 ++++++++++++++++------------ .emacs.pure | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 80 insertions(+), 16 deletions(-) diff --git a/.emacs b/.emacs index 8c3db0b..0297b09 100644 --- a/.emacs +++ b/.emacs @@ -55,6 +55,35 @@ ;; vim-Scroll (setq scroll-conservatively 1) +;; European datatime format +(setq calendar-date-display-form + '((if dayname (concat dayname ", ")) day " " monthname " " year)) +(setq calendar-time-display-form + '(24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))) + +;; week starts on Monday +(setq calendar-week-start-day 1) +(setq org-agenda-start-on-weekday 1) + +;; display week numbers +(setq calendar-intermonth-text + '(propertize + (format "%2d" + (car + (calendar-iso-from-absolute + (calendar-absolute-from-gregorian (list month day year))))) + 'font-lock-face 'font-lock-warning-face)) + +(setq calendar-intermonth-header + (propertize "Wnr" ; or e.g. "KW" in Germany + 'font-lock-face 'font-lock-keyword-face)) + + +;; sunrise / sunset +;; (setq calendar-latitude 59.98765) +;; (setq calendar-longitude 10.98765) +;; (setq calendar-location-name "Oslo") + ;; Various (setq auto-save-default nil) (setq make-backup-files nil) @@ -76,8 +105,9 @@ ;; Programming section ;; Indentation -(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil js-indent-level 4 sgml-basic-offset 4) -;;(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil) +;;(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil js-indent-level 4 sgml-basic-offset 4) +(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil) +;;(setq js-indent-level 2) ;;(setq-default c-basic-offset 4 tab-width 4) ;; Default coding style diff --git a/.emacs.d/lisp/lua-mode.el b/.emacs.d/lisp/lua-mode.el index 6c524f5..be56111 100644 --- a/.emacs.d/lisp/lua-mode.el +++ b/.emacs.d/lisp/lua-mode.el @@ -376,8 +376,8 @@ If the latter is nil, the keymap translates into `lua-mode-map' verbatim.") "Keymap used in lua-mode buffers.") (defvar lua-electric-flag t - "If t, electric actions (like automatic reindentation) will happen when an electric - key like `{' is pressed") + "If t, electric actions will happen when an electric key like `{' is pressed. +Automatic reindentation is an example of an electric action.") (make-variable-buffer-local 'lua-electric-flag) (defcustom lua-prompt-regexp "[^\n]*\\(>[\t ]+\\)+$" @@ -1054,9 +1054,15 @@ found, returns point position, nil otherwise." Each token information entry is of the form: KEYWORD FORWARD-MATCH-REGEXP BACKWARDS-MATCH-REGEXP TOKEN-TYPE KEYWORD is the token. -FORWARD-MATCH-REGEXP is a regexp that matches all possible tokens when going forward. -BACKWARDS-MATCH-REGEXP is a regexp that matches all possible tokens when going backwards. -TOKEN-TYPE determines where the token occurs on a statement. open indicates that the token appears at start, close indicates that it appears at end, middle indicates that it is a middle type token, and middle-or-open indicates that it can appear both as a middle or an open type.") +FORWARD-MATCH-REGEXP is a regexp that matches all possible tokens + when going forward. +BACKWARDS-MATCH-REGEXP is a regexp that matches all possible tokens + when going backwards. +TOKEN-TYPE determines where the token occurs on a statement. `open' + indicates that the token appears at start, close indicates that it + appears at end, `middle' indicates that it is a middle type token, + and `middle-or-open' indicates that it can appear both as a middle + or an open type.") (defconst lua-indentation-modifier-regexp ;; The absence of else is deliberate, since it does not modify the @@ -1442,14 +1448,12 @@ The criteria for a continuing statement are: (defun lua-is-continuing-statement-p (&optional parse-start) - "Returns non-nil if the line at PARSE-START should be indented as continuation line. + "Return non-nil if line at PARSE-START is a continuation line. -This true is when the line : - -* is continuing a statement itself - -* starts with a 1+ block-closer tokens, an top-most block opener is on a continuation line -" +This affects how it should be indented. A line is a continuation line if +- it is continuing a statement itself, or +- it starts with a 1+ block-closer tokens, an top-most block opener is on + a continuation line." (save-excursion (if parse-start (goto-char parse-start)) diff --git a/.emacs.pure b/.emacs.pure index 1f703c7..a4d0a17 100644 --- a/.emacs.pure +++ b/.emacs.pure @@ -55,6 +55,35 @@ ;; vim-Scroll (setq scroll-conservatively 1) +;; European datatime format +(setq calendar-date-display-form + '((if dayname (concat dayname ", ")) day " " monthname " " year)) +(setq calendar-time-display-form + '(24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))) + +;; week starts on Monday +(setq calendar-week-start-day 1) +(setq org-agenda-start-on-weekday 1) + +;; display week numbers +(setq calendar-intermonth-text + '(propertize + (format "%2d" + (car + (calendar-iso-from-absolute + (calendar-absolute-from-gregorian (list month day year))))) + 'font-lock-face 'font-lock-warning-face)) + +(setq calendar-intermonth-header + (propertize "Wnr" ; or e.g. "KW" in Germany + 'font-lock-face 'font-lock-keyword-face)) + + +;; sunrise / sunset +;; (setq calendar-latitude 59.98765) +;; (setq calendar-longitude 10.98765) +;; (setq calendar-location-name "Oslo") + ;; Various (setq auto-save-default nil) (setq make-backup-files nil) @@ -76,8 +105,9 @@ ;; Programming section ;; Indentation -(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil js-indent-level 4 sgml-basic-offset 4) -;;(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil) +;;(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil js-indent-level 4 sgml-basic-offset 4) +(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil) +;;(setq js-indent-level 2) ;;(setq-default c-basic-offset 4 tab-width 4) ;; Default coding style -- cgit v1.3