#usepackage — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #usepackage, aggregated by home.social.
-
#irreal and @bbatsov about #Emacs startup time: https://irreal.org/blog/?p=12903
I, too, am totally convinced that it really doesn't matter if it is one or sixty seconds.
However, if your bootup time is much longer than mine (15-30s once a week) then you most probably have room for improvement (if you want). Consistent use of #usepackage with dependencies and "defer" did help on my side.
My config has 7724 lines of #elisp (19851 including #orgmode comments): https://github.com/novoid/dot-emacs/blob/master/config.org
-
I use emacs as my editor and have it configured to delete all trailing whitespace in a file, including any trailing newlines at the end, before saving it. The configuration snippet that I have in my emacs configuration file to do this is
(add-hook 'before-save-hook 'delete-trailing-whitespace)
While this is very convenient and works as expected, it becomes a hindrance in specific cases – the Jinja2 templating language deletes a single trailing newline, thereby leaving the rendered templates without a newline at the end.
One way to work around this behaviour is to add 2 trailing newlines in the jinja2 template files. But unfortunately, due to my emacs configuration that deletes all trailing whitespace, this doesn’t work. So I started reading the documentation for the delete-trailing-whitespace function and found out about the delete-trailing-newlines variable (default: t). This variable controls whether the trailing newline characters at the end of a file are deleted or not. So I wanted to try overriding the delete-trailing-newlines variable to be false in jinja2-mode, that I use for editing Jinja2 templates.
With some help from the excellent folks in the #emacs IRC channel on Libera Chat, I was able to come up with the following configuration, that works as expected.
(use-package jinja2-mode :pin nongnu :hook (jinja2-mode . (lambda () (setq-local delete-trailing-lines nil))) :mode "\\.j2\\'")
Note that I use the excellent use-package macro to install the jinja2-mode and configure it appropriately. If you don’t use use-package, this can be done using the add-hook function.
#emacs #jinja2 #trailing-newlines #trailing-whitespace #use-package
-
I use emacs as my editor and have it configured to delete all trailing whitespace in a file, including any trailing newlines at the end, before saving it. The configuration snippet that I have in my emacs configuration file to do this is
(add-hook 'before-save-hook 'delete-trailing-whitespace)
While this is very convenient and works as expected, it becomes a hindrance in specific cases – the Jinja2 templating language deletes a single trailing newline, thereby leaving the rendered templates without a newline at the end.
One way to work around this behaviour is to add 2 trailing newlines in the jinja2 template files. But unfortunately, due to my emacs configuration that deletes all trailing whitespace, this doesn’t work. So I started reading the documentation for the delete-trailing-whitespace function and found out about the delete-trailing-newlines variable (default: t). This variable controls whether the trailing newline characters at the end of a file are deleted or not. So I wanted to try overriding the delete-trailing-newlines variable to be false in jinja2-mode, that I use for editing Jinja2 templates.
With some help from the excellent folks in the #emacs IRC channel on Libera Chat, I was able to come up with the following configuration, that works as expected.
(use-package jinja2-mode :pin nongnu :hook (jinja2-mode . (lambda () (setq-local delete-trailing-lines nil))) :mode "\\.j2\\'")
Note that I use the excellent use-package macro to install the jinja2-mode and configure it appropriately. If you don’t use use-package, this can be done using the add-hook function.
#emacs #jinja2 #trailing-newlines #trailing-whitespace #use-package
-
I use emacs as my editor and have it configured to delete all trailing whitespace in a file, including any trailing newlines at the end, before saving it. The configuration snippet that I have in my emacs configuration file to do this is
(add-hook 'before-save-hook 'delete-trailing-whitespace)
While this is very convenient and works as expected, it becomes a hindrance in specific cases – the Jinja2 templating language deletes a single trailing newline, thereby leaving the rendered templates without a newline at the end.
One way to work around this behaviour is to add 2 trailing newlines in the jinja2 template files. But unfortunately, due to my emacs configuration that deletes all trailing whitespace, this doesn’t work. So I started reading the documentation for the delete-trailing-whitespace function and found out about the delete-trailing-newlines variable (default: t). This variable controls whether the trailing newline characters at the end of a file are deleted or not. So I wanted to try overriding the delete-trailing-newlines variable to be false in jinja2-mode, that I use for editing Jinja2 templates.
With some help from the excellent folks in the #emacs IRC channel on Libera Chat, I was able to come up with the following configuration, that works as expected.
(use-package jinja2-mode :pin nongnu :hook (jinja2-mode . (lambda () (setq-local delete-trailing-lines nil))) :mode "\\.j2\\'")
Note that I use the excellent use-package macro to install the jinja2-mode and configure it appropriately. If you don’t use use-package, this can be done using the add-hook function.
#emacs #jinja2 #trailing-newlines #trailing-whitespace #use-package
-
I use emacs as my editor and have it configured to delete all trailing whitespace in a file, including any trailing newlines at the end, before saving it. The configuration snippet that I have in my emacs configuration file to do this is
(add-hook 'before-save-hook 'delete-trailing-whitespace)
While this is very convenient and works as expected, it becomes a hindrance in specific cases – the Jinja2 templating language deletes a single trailing newline, thereby leaving the rendered templates without a newline at the end.
One way to work around this behaviour is to add 2 trailing newlines in the jinja2 template files. But unfortunately, due to my emacs configuration that deletes all trailing whitespace, this doesn’t work. So I started reading the documentation for the delete-trailing-whitespace function and found out about the delete-trailing-newlines variable (default: t). This variable controls whether the trailing newline characters at the end of a file are deleted or not. So I wanted to try overriding the delete-trailing-newlines variable to be false in jinja2-mode, that I use for editing Jinja2 templates.
With some help from the excellent folks in the #emacs IRC channel on Libera Chat, I was able to come up with the following configuration, that works as expected.
(use-package jinja2-mode :pin nongnu :hook (jinja2-mode . (lambda () (setq-local delete-trailing-lines nil))) :mode "\\.j2\\'")
Note that I use the excellent use-package macro to install the jinja2-mode and configure it appropriately. If you don’t use use-package, this can be done using the add-hook function.
#emacs #jinja2 #trailing-newlines #trailing-whitespace #use-package
-
I use emacs as my editor and have it configured to delete all trailing whitespace in a file, including any trailing newlines at the end, before saving it. The configuration snippet that I have in my emacs configuration file to do this is
(add-hook 'before-save-hook 'delete-trailing-whitespace)
While this is very convenient and works as expected, it becomes a hindrance in specific cases – the Jinja2 templating language deletes a single trailing newline, thereby leaving the rendered templates without a newline at the end.
One way to work around this behaviour is to add 2 trailing newlines in the jinja2 template files. But unfortunately, due to my emacs configuration that deletes all trailing whitespace, this doesn’t work. So I started reading the documentation for the delete-trailing-whitespace function and found out about the delete-trailing-newlines variable (default: t). This variable controls whether the trailing newline characters at the end of a file are deleted or not. So I wanted to try overriding the delete-trailing-newlines variable to be false in jinja2-mode, that I use for editing Jinja2 templates.
With some help from the excellent folks in the #emacs IRC channel on Libera Chat, I was able to come up with the following configuration, that works as expected.
(use-package jinja2-mode :pin nongnu :hook (jinja2-mode . (lambda () (setq-local delete-trailing-lines nil))) :mode "\\.j2\\'")
Note that I use the excellent use-package macro to install the jinja2-mode and configure it appropriately. If you don’t use use-package, this can be done using the add-hook function.
#emacs #jinja2 #trailing-newlines #trailing-whitespace #use-package
-
It was fun when rewriting my #Emacs configuration with #SetupEl (https://git.sr.ht/~pkal/setup), which offered a much easier way to define custom keywords, compared with other configuration managers( #UsePackage, #Leaf) 🥹
-
Can I tell Emacs and/or use-package to activate a package when I launched Emacs from a directory ?
I thought about
(when (string= "~/Workspace/" default-directory)
...)But… no haha
(for the record: I don't want to write a passphrase anytime org-mode is enabled in a buffer)
-
Intro til LaTeX
Vi starter med det enkleste dokumentet en kan lage i LaTeX med en tekst om en ny og spennede elektrisk bil tatt i fra Teknisk Ukeblad fra noen år tilbake. -
Intro til LaTeX
Vi starter med det enkleste dokumentet en kan lage i LaTeX med en tekst om en ny og spennede elektrisk bil tatt i fra Teknisk Ukeblad fra noen år tilbake. -
Intro til LaTeX
Vi starter med det enkleste dokumentet en kan lage i LaTeX med en tekst om en ny og spennede elektrisk bil tatt i fra Teknisk Ukeblad fra noen år tilbake. -
Intro til LaTeX
Vi starter med det enkleste dokumentet en kan lage i LaTeX med en tekst om en ny og spennede elektrisk bil tatt i fra Teknisk Ukeblad fra noen år tilbake.