* Re: Size of startup files
2022-11-20 19:42 Size of startup files Bob Newell
@ 2022-11-20 20:24 ` Colin Baxter
2022-11-21 21:52 ` Bob Newell
2022-11-20 22:07 ` Rudolf Adamkovič
` (3 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: Colin Baxter @ 2022-11-20 20:24 UTC (permalink / raw)
To: Bob Newell; +Cc: help-gnu-emacs
Hello Bob,
>>>>> Bob Newell <bobnewell@bobnewell.net> writes:
> Aloha, This is just a 'curiosity' question as I wonder if I am off
> the deep end even for an Emacs user, which would be really saying
> something.
> I just took a quick look and found that my startup files (called
> from .emacs and so on) amount to about 5,000 lines of elisp. Of
> course I comment extensively but at least half of this or more is
> actual code.
Mine is 8735 lines but like you much of it commented explanation. I
think org-mode and auctex must account for most of the code.
Best wishes,
Colin.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Size of startup files
2022-11-20 20:24 ` Colin Baxter
@ 2022-11-21 21:52 ` Bob Newell
2022-11-22 10:00 ` Eric S Fraga
0 siblings, 1 reply; 19+ messages in thread
From: Bob Newell @ 2022-11-21 21:52 UTC (permalink / raw)
To: help-gnu-emacs
Thanks for the interesting replies. Perhaps unsurprisingly,
it demonstrates again just how "personal" emacs is and how it
becomes more and more so over time.
However, I think the extent of it would stagger the
uninitiated, and this raises a practical point. When
attracting newcomers to emacs, they need to hear that you
don't have to eat the elephant whole, and that with time and
experience they will find their own best ways.
--
Bob Newell
Honolulu, Hawai`i
- Via GNU/Linux/Emacs/Gnus/BBDB
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Size of startup files
2022-11-21 21:52 ` Bob Newell
@ 2022-11-22 10:00 ` Eric S Fraga
0 siblings, 0 replies; 19+ messages in thread
From: Eric S Fraga @ 2022-11-22 10:00 UTC (permalink / raw)
To: help-gnu-emacs
On Monday, 21 Nov 2022 at 11:52, Bob Newell wrote:
> However, I think the extent of it would stagger the
> uninitiated, and this raises a practical point. When
> attracting newcomers to emacs, they need to hear that you
> don't have to eat the elephant whole, and that with time and
> experience they will find their own best ways.
Good point.
I guess one way to look at it is that, given my numbers (a little over
4000 lines of customization but using Emacs since mid 80s), I have added
100 lines of customization approximately per year. Not that much... ;-)
--
Eric S Fraga via gnus (Emacs 29.0.50 2022-11-13) on Debian 11.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Size of startup files
2022-11-20 19:42 Size of startup files Bob Newell
2022-11-20 20:24 ` Colin Baxter
@ 2022-11-20 22:07 ` Rudolf Adamkovič
2022-11-21 0:46 ` Samuel Wales
2022-11-21 9:37 ` Eric S Fraga
` (2 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: Rudolf Adamkovič @ 2022-11-20 22:07 UTC (permalink / raw)
To: Bob Newell, help-gnu-emacs
Bob Newell <bobnewell@bobnewell.net> writes:
> I just took a quick look and found that my startup files
> (called from .emacs and so on) amount to about 5,000 lines of
> elisp. Of course I comment extensively but at least half of
> this or more is actual code.
My configuration weighs 3358 LOC. The number *excludes* comments, for I
have none. I tangle the it from a 51,712-LOC Org notebook that contains
all Emacs configuration and notes I have, along with other notes.
Rudy
--
"Logic is a science of the necessary laws of thought, without which no
employment of the understanding and the reason takes place."
-- Immanuel Kant, 1785
Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Size of startup files
2022-11-20 22:07 ` Rudolf Adamkovič
@ 2022-11-21 0:46 ` Samuel Wales
0 siblings, 0 replies; 19+ messages in thread
From: Samuel Wales @ 2022-11-21 0:46 UTC (permalink / raw)
To: Rudolf Adamkovič; +Cc: Bob Newell, help-gnu-emacs
32k lines.
12k lines when i grep -v comments.
On 11/20/22, Rudolf Adamkovič <salutis@me.com> wrote:
> Bob Newell <bobnewell@bobnewell.net> writes:
>
>> I just took a quick look and found that my startup files
>> (called from .emacs and so on) amount to about 5,000 lines of
>> elisp. Of course I comment extensively but at least half of
>> this or more is actual code.
>
> My configuration weighs 3358 LOC. The number *excludes* comments, for I
> have none. I tangle the it from a 51,712-LOC Org notebook that contains
> all Emacs configuration and notes I have, along with other notes.
>
> Rudy
> --
> "Logic is a science of the necessary laws of thought, without which no
> employment of the understanding and the reason takes place."
> -- Immanuel Kant, 1785
>
> Rudolf Adamkovič <salutis@me.com> [he/him]
> Studenohorská 25
> 84103 Bratislava
> Slovakia
>
>
--
The Kafka Pandemic
A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Size of startup files
2022-11-20 19:42 Size of startup files Bob Newell
2022-11-20 20:24 ` Colin Baxter
2022-11-20 22:07 ` Rudolf Adamkovič
@ 2022-11-21 9:37 ` Eric S Fraga
2022-11-21 22:00 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-11-22 10:44 ` Marcin Borkowski
4 siblings, 0 replies; 19+ messages in thread
From: Eric S Fraga @ 2022-11-21 9:37 UTC (permalink / raw)
To: help-gnu-emacs
Without comments (I use org to generate my .el init files), I have a
little over 4000 lines of elisp code built up over the past 4 decades.
--
Eric S Fraga via gnus (Emacs 29.0.50 2022-11-13) on Debian 11.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Size of startup files
2022-11-20 19:42 Size of startup files Bob Newell
` (2 preceding siblings ...)
2022-11-21 9:37 ` Eric S Fraga
@ 2022-11-21 22:00 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-11-21 23:10 ` Emanuel Berg
2022-11-21 23:20 ` Size of startup files Emanuel Berg
2022-11-22 10:44 ` Marcin Borkowski
4 siblings, 2 replies; 19+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-11-21 22:00 UTC (permalink / raw)
To: help-gnu-emacs
> I just took a quick look and found that my startup files
> (called from .emacs and so on) amount to about 5,000 lines of
> elisp. Of course I comment extensively but at least half of
> this or more is actual code.
My init file never reached that size: I think around the time it was
inching its way toward 2k lines, I decided I should change Emacs
instead.
So in a sense, my init file is now somewhere around 2M lines :-(
Stefan
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Size of startup files
2022-11-21 22:00 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2022-11-21 23:10 ` Emanuel Berg
2022-11-22 7:02 ` Pankaj Jangid
2022-11-23 10:54 ` libraries (was: Re: Size of startup files) Emanuel Berg
2022-11-21 23:20 ` Size of startup files Emanuel Berg
1 sibling, 2 replies; 19+ messages in thread
From: Emanuel Berg @ 2022-11-21 23:10 UTC (permalink / raw)
To: help-gnu-emacs
Stefan Monnier via Users list for the GNU Emacs text editor wrote:
>> I just took a quick look and found that my startup files
>> (called from .emacs and so on) amount to about 5,000 lines
>> of elisp. Of course I comment extensively but at least half
>> of this or more is actual code.
>
> My init file never reached that size: I think around the time it was
> inching its way toward 2k lines
I have 9 317 lines in 165 files ...
> I decided I should change Emacs instead. So in a sense, my
> init file is now somewhere around 2M lines :-(
On the contrary, that's good for all of us!
But on the whole, it is not a sane situation. What we should
have is a set of libraries that have very basic and
self-explicatory names, then it would be so easy to find out
if some functionality is already available - and if not, where
to add it ...
For example, I'd like to have a math library for thing like
the blow Elisp, which I have in my own Elisp at the moment ...
(defalias '** #'expt)
(defalias 'ceil #'ceiling)
(defun // (nom denom)
(/ nom denom 1.0) )
;; (/ 8 256) ; 0 *oups*
;; (// 8 256) ; 0.03125
(defun mean-value (vs)
(let*((sum (apply #'+ vs))
(mean (/ sum (length vs) 1.0)) )
mean) )
(defun percent (nom &optional denom str)
(or denom (setq denom 1))
(let ((perc (/ nom denom 0.01)))
(if str
(format "%.1f%%" perc)
perc)))
;; (percent 0.25) ; 25.0
;; (percent 50 75) ; 66.66 ...
;; (percent (// 1 2) nil t) ; 50.0%
;; (percent 1019 22 t) ; 4631.8%
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Size of startup files
2022-11-21 23:10 ` Emanuel Berg
@ 2022-11-22 7:02 ` Pankaj Jangid
2022-11-22 11:45 ` Jean Louis
2022-11-22 14:34 ` M-x toggle-theme Jean Louis
2022-11-23 10:54 ` libraries (was: Re: Size of startup files) Emanuel Berg
1 sibling, 2 replies; 19+ messages in thread
From: Pankaj Jangid @ 2022-11-22 7:02 UTC (permalink / raw)
To: help-gnu-emacs
Emanuel Berg <incal@dataswamp.org> writes:
> Stefan Monnier via Users list for the GNU Emacs text editor wrote:
>
>>> I just took a quick look and found that my startup files
>>> (called from .emacs and so on) amount to about 5,000 lines
>>> of elisp. Of course I comment extensively but at least half
>>> of this or more is actual code.
>>
>> My init file never reached that size: I think around the time it was
>> inching its way toward 2k lines
>
> I have 9 317 lines in 165 files ...
>
I attempt to cleanup the init file very frequently... every quarter may
be. And the total number of lines is <1k. Not many comments in my file.
For example,
1. I removed code to install eglot, now that it is available as a
builtin feature.
2. Earlier I wrote a function to toggle themes. Now it is builtin.
And after use-package's inclusion, the file size will further reduce.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Size of startup files
2022-11-22 7:02 ` Pankaj Jangid
@ 2022-11-22 11:45 ` Jean Louis
2022-11-22 14:34 ` M-x toggle-theme Jean Louis
1 sibling, 0 replies; 19+ messages in thread
From: Jean Louis @ 2022-11-22 11:45 UTC (permalink / raw)
To: help-gnu-emacs
If the init file loads other libraries, then those libraries shall
also be included in counting of startup line sizes.
If we speak of loaded libraries, then instead of asking for line
sizes, it is better to ask people which libraries they constantly use.
I have separated customized variables in ~/.emacs.d/custom.el and it's
size is 653 lines. I do not program it neither change that file, it is
managed by {M-x customize}
I use for example:
(require 'dired-x)
(require 'facemenu)
(require 'enriched)
(require 'gold-price)
(require 'persistent-scratch nil t)
(require 'rcd-password)
(require 'rcd-db-basics)
(require 'rcd-cf)
(require 'windmove)
(require 'rcd-vc)
(load "image-stamp")
(load "rcd-dict")
(load "units")
plus Hyperbole and some additional library. I must have that for
personal work.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 19+ messages in thread
* M-x toggle-theme
2022-11-22 7:02 ` Pankaj Jangid
2022-11-22 11:45 ` Jean Louis
@ 2022-11-22 14:34 ` Jean Louis
2022-11-22 16:59 ` Philip Kaludercic
1 sibling, 1 reply; 19+ messages in thread
From: Jean Louis @ 2022-11-22 14:34 UTC (permalink / raw)
To: help-gnu-emacs
* Pankaj Jangid <pankaj@codeisgreat.org> [2022-11-22 10:03]:
> 2. Earlier I wrote a function to toggle themes. Now it is builtin.
I have just tried: M-x toggle-theme and I get error:
toggle-theme: Theme ‘light-blue’ does not have any known variants
This may be because
'(custom-enabled-themes '(light-blue))
So toggle-theme should have better working.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: M-x toggle-theme
2022-11-22 14:34 ` M-x toggle-theme Jean Louis
@ 2022-11-22 16:59 ` Philip Kaludercic
2022-11-22 17:48 ` Akib Azmain Turja
0 siblings, 1 reply; 19+ messages in thread
From: Philip Kaludercic @ 2022-11-22 16:59 UTC (permalink / raw)
To: help-gnu-emacs
Jean Louis <bugs@gnu.support> writes:
> * Pankaj Jangid <pankaj@codeisgreat.org> [2022-11-22 10:03]:
>> 2. Earlier I wrote a function to toggle themes. Now it is builtin.
>
> I have just tried: M-x toggle-theme and I get error:
>
> toggle-theme: Theme ‘light-blue’ does not have any known variants
>
> This may be because
>
> '(custom-enabled-themes '(light-blue))
>
> So toggle-theme should have better working.
You misunderstand the mechanism by which toggle-theme works. A theme
may declare a family:
(deftheme tsdh-light
"A light Emacs theme.
Used and created by Tassilo Horn."
:background-mode 'light
:kind 'color-scheme
:family 'tsdh)
When a theme of this family is enabled, M-x toggle-theme will either
prompt the user or toggle the theme to some other member of the family
automatically (the latter works if there are only two themes to switch
between).
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: M-x toggle-theme
2022-11-22 16:59 ` Philip Kaludercic
@ 2022-11-22 17:48 ` Akib Azmain Turja
2022-11-22 18:08 ` Philip Kaludercic
0 siblings, 1 reply; 19+ messages in thread
From: Akib Azmain Turja @ 2022-11-22 17:48 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]
Philip Kaludercic <philipk@posteo.net> writes:
> Jean Louis <bugs@gnu.support> writes:
>
>> * Pankaj Jangid <pankaj@codeisgreat.org> [2022-11-22 10:03]:
>>> 2. Earlier I wrote a function to toggle themes. Now it is builtin.
>>
>> I have just tried: M-x toggle-theme and I get error:
>>
>> toggle-theme: Theme ‘light-blue’ does not have any known variants
>>
>> This may be because
>>
>> '(custom-enabled-themes '(light-blue))
>>
>> So toggle-theme should have better working.
>
> You misunderstand the mechanism by which toggle-theme works. A theme
> may declare a family:
>
> (deftheme tsdh-light
> "A light Emacs theme.
> Used and created by Tassilo Horn."
> :background-mode 'light
> :kind 'color-scheme
> :family 'tsdh)
>
> When a theme of this family is enabled, M-x toggle-theme will either
> prompt the user or toggle the theme to some other member of the family
> automatically (the latter works if there are only two themes to switch
> between).
>
This is nice, no need for modus-themes-toggle in modus-themes.
--
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: M-x toggle-theme
2022-11-22 17:48 ` Akib Azmain Turja
@ 2022-11-22 18:08 ` Philip Kaludercic
0 siblings, 0 replies; 19+ messages in thread
From: Philip Kaludercic @ 2022-11-22 18:08 UTC (permalink / raw)
To: Akib Azmain Turja; +Cc: help-gnu-emacs
Akib Azmain Turja <akib@disroot.org> writes:
> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Jean Louis <bugs@gnu.support> writes:
>>
>>> * Pankaj Jangid <pankaj@codeisgreat.org> [2022-11-22 10:03]:
>>>> 2. Earlier I wrote a function to toggle themes. Now it is builtin.
>>>
>>> I have just tried: M-x toggle-theme and I get error:
>>>
>>> toggle-theme: Theme ‘light-blue’ does not have any known variants
>>>
>>> This may be because
>>>
>>> '(custom-enabled-themes '(light-blue))
>>>
>>> So toggle-theme should have better working.
>>
>> You misunderstand the mechanism by which toggle-theme works. A theme
>> may declare a family:
>>
>> (deftheme tsdh-light
>> "A light Emacs theme.
>> Used and created by Tassilo Horn."
>> :background-mode 'light
>> :kind 'color-scheme
>> :family 'tsdh)
>>
>> When a theme of this family is enabled, M-x toggle-theme will either
>> prompt the user or toggle the theme to some other member of the family
>> automatically (the latter works if there are only two themes to switch
>> between).
>>
>
> This is nice, no need for modus-themes-toggle in modus-themes.
There was an attempt to deprecate that command in favour of
toggle-theme, but Prot decided against it:
https://lists.sr.ht/~protesilaos/modus-themes/%3C877d116lh4.fsf%40posteo.net%3E#%3C87y1tdeeyw.fsf@protesilaos.com%3E
^ permalink raw reply [flat|nested] 19+ messages in thread
* libraries (was: Re: Size of startup files)
2022-11-21 23:10 ` Emanuel Berg
2022-11-22 7:02 ` Pankaj Jangid
@ 2022-11-23 10:54 ` Emanuel Berg
1 sibling, 0 replies; 19+ messages in thread
From: Emanuel Berg @ 2022-11-23 10:54 UTC (permalink / raw)
To: help-gnu-emacs
> But on the whole, it is not a sane situation. What we should
> have is a set of libraries that have very basic and
> self-explicatory names, then it would be so easy to find out
> if some functionality is already available - and if not,
> where to add it ...
>
> For example, I'd like to have a math library for thing like
> the blow Elisp, which I have in my own Elisp at the moment ...
Do we have a math library?
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Size of startup files
2022-11-21 22:00 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-11-21 23:10 ` Emanuel Berg
@ 2022-11-21 23:20 ` Emanuel Berg
1 sibling, 0 replies; 19+ messages in thread
From: Emanuel Berg @ 2022-11-21 23:20 UTC (permalink / raw)
To: help-gnu-emacs
> (defun percent (nom &optional denom str)
> (or denom (setq denom 1))
> (let ((perc (/ nom denom 0.01)))
> (if str
> (format "%.1f%%" perc)
> perc)))
And if we had such a library, maybe someone would improve this
by makin the string branch output with the correct number of
significant digits!
It's just an example, but it's a good one as it makes sense.
It should be like this:
* Everyone does their own customization (obviously)
* Everyone does their own original/creative projects (or ditto
just-for-fun elisping)
* But everyone should not do this basic stuff over and over,
instead it should be found in libraries - incomplete and
poor as they may be day one, in time they will be improved
to become a huge asset.
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Size of startup files
2022-11-20 19:42 Size of startup files Bob Newell
` (3 preceding siblings ...)
2022-11-21 22:00 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2022-11-22 10:44 ` Marcin Borkowski
2022-11-22 14:45 ` Emanuel Berg
4 siblings, 1 reply; 19+ messages in thread
From: Marcin Borkowski @ 2022-11-22 10:44 UTC (permalink / raw)
To: Bob Newell; +Cc: help-gnu-emacs
On 2022-11-20, at 20:42, Bob Newell <bobnewell@bobnewell.net> wrote:
> Aloha,
>
> This is just a 'curiosity' question as I wonder if I am off
> the deep end even for an Emacs user, which would be really
> saying something.
>
> I just took a quick look and found that my startup files
> (called from .emacs and so on) amount to about 5,000 lines of
> elisp. Of course I comment extensively but at least half of
> this or more is actual code.
(shameless-plug
In the Elisp book I wrote last year I included a fairly simple code to
count SLOC, excluding blank lines and comment-only lines. Why not try
this on your init file?
--8<---------------cut here---------------start------------->8---
; -*- lexical-binding: t; -*-
(defun count-sloc--count-lines-if (predicate begin end)
"Count lines satisfying PREDICATE from BEGIN to END.
PREDICATE should accept no arguments."
(save-excursion
(save-restriction
(narrow-to-region begin end)
(goto-char begin)
(let ((count 0))
(while (not (eobp))
(when (funcall predicate)
(setq count (1+ count)))
(forward-line))
count))))
(defun count-sloc--act-on-region-or-buffer (func message)
"Perform FUNC on region or buffer and print MESSAGE.
FUNC should accept two arguments, the beginning and end of the
range it operates on. If MESSAGE contains
a placeholder (e.g. \"%s\"), the return value of FUNC is
substituted for it."
(let (begin end)
(if (use-region-p)
(setq begin (region-beginning) end (region-end))
(setq begin (point-min) end (point-max)))
(message message (funcall func begin end))))
(defun count-sloc--comment-or-blank-line-p ()
"Return t if the point is at a comment line.
Assume that the point is at the beginning of line."
(unless (nth 3 (syntax-ppss))
(save-excursion
(let ((orig-line-number (line-number-at-pos)))
(forward-comment 1000)
(or (not (eq orig-line-number (line-number-at-pos)))
(eobp))))))
(defun count-sloc--negate (fun)
"Return a function returning the logical opposite of FUN."
(lambda (&rest args)
(not (apply fun args))))
(defun count-sloc ()
"Count non-blank lines in the region or buffer."
(interactive)
(count-sloc--act-on-region-or-buffer
(apply-partially #'count-sloc--count-lines-if
(count-sloc--negate
#'count-sloc--comment-or-blank-line-p))
"Non-blank lines: %s"))
--8<---------------cut here---------------end--------------->8---
My init.el is 1591 lines long (excluding comment/blank lines) and 2317
lines including them. (But it includes a few other files.) Also, my
init.el is /very/ messy (I will make it better Some Day™.)
)
Best,
--
Marcin Borkowski
http://mbork.pl
^ permalink raw reply [flat|nested] 19+ messages in thread