Live data from Hacker News

916 Days of Emacs

sqrtminusone.xyz

211–220 of 309 posts

Re: 916 Days of Emacs

#211

Earlier quoted context omitted.

everything you refer to is less than 0.5% of emacs use maybe 0.2% of all emacs users even know EmacsConf exists maybe 1% know of Sacha Chua, doubt it though, probably 0.1% have heard of her easily over 99% of emacs use is for coding, actually that is low, if you snapshotted all emacs sessions in the world right now, more like 99.9% of them would be coding I'm not even sure why this is being debated

Simple: I'm giving you some data points, skewed as they may be. You're providing no data. And so you're right - there is no debate.

[flagged]

Re: 916 Days of Emacs

#212

Earlier quoted context omitted.

> They seem awfully limited to me by comparison. Can you list your most important feature(s) in chosen your ide or editor that you suspect emacs doesn't have or can't easily have?

How about the intellij inspections? It's a ton of lints that underline bits of your code as you type, with a wavy line, and you can hover over it to see what the problem is, and even potentially fix it automatically. Is there anything like that in the emacs world?

The ESS package (“Emacs Speaks Statistics”) does something like that for R without using a language server.

`lsp-ui` does it for Rust at the very least but probably for other languages too.

Re: 916 Days of Emacs

#213

I've been a hardcore vi user pretty much my entire life, but I decided to force myself to spend a year using emacs a while back just to see what all the fuss was about. When the year was over and I "allowed" myself to return to vi, it was like a huge weight lifted off my shoulders... to this day I still don't see what the hype was about. On the plus side, though, I memorized the emacs cursor movement commands, which…

why didn't you just use evil mode? vim is great and so is emacs and with evil mode you get vim inside emacs. i still use emacs for magit as it's hands down the best git gui i've seen so far.

i used to use spacemacs but just wanted a quicker startup while still being reasonably configured... doom emacs is both.

Re: 916 Days of Emacs

#214
post #52

Earlier quoted context omitted.

> There’s really nothing killer in Emacs 1. Org mode 2. Magit 3. Wdired 4. Synergy between various components (shameless plug: https://mbork.pl/2023-01-30_The_benefits_of_everything_being... )

1. Org mode - I will admit that I'm not a fan of org mode and find it to be oversold and another time waster for people who are already wasting time configuring their editors. I personally use vimwiki, there is a vim plugin for org mode. 2. Magit - Tim Pope is the pope of Vim plugins and fugitive is easily as good or better than Magit. I have never had any issue doing any sort of complex task in git or fixing conflic…

Emacs is a lisp refugee in Unixland. It does not follow the Unix philosophy, it follows the Lisp philosophy. But it integrates.

-- Source unknown (to me)

Re: 916 Days of Emacs

#215
post #31

Earlier quoted context omitted.

The default cursor movement commands probably predate emacs. Such that you are used to readline defaults. https://news.ycombinator.com/item?id=24083753 is the first post I'm finding on that. That said, I'm curious what the weight of emacs was on you? If it was that you were wanting to be in the other editor, than it makes sense that you should stay in the other editor. But this is no different than a lot of things. I…

> what the weight of emacs was on you What I've noticed about emacs lovers is that they all customize it heavily - I didn't want to do that, since to me the point of using a plain text editor is that it's always available in exactly the same form wherever I happen to be. I did start to looking into all the ways to customize it, but at that point, I couldn't really see much benefit over just using an IDE. But that's j…

I have all my emacs stuff in a git repo called .emacs.d. Wherever I am, I clone it into my home folder, and Emacs picks it up when I run it. Then it ends up looking the same as it always is.

"But what if you end up somewhere where you can't do this?" - well, when it happens, I guess I will figure something out! But I've had no problems so far, and I've been doing this a while.

    tmbp ~/.emacs.d % git log | tail -n 1
    Date:   Sat Feb 23 23:30:41 2008 +0000
(Before that I used svn, also with no problems.)

My config currently works with Windows, macOS and Linux, terminal or GUI, and with any Emacs from 26 to 29, and it behaves about the same in all cases. This didn't take much effort! - though each untested combination have a bad habit of requiring 5-10 minutes of fiddling about.

Re: 916 Days of Emacs

#216

282 hours of configuration! If we subtract the weekends from that 916 days, that's an average of about 45 mins a day fiddling with config. I don't even want to spend 45 mins a month fiddling with config. I really don't understand Emacs people.

> I don't even want to spend 45 mins a month fiddling with config. I really don't understand Emacs people. Some people like to customize their environment to their exact specifications. Others will use whatever is available and never change it. That is not required. Although default Emacs is pretty barebones (from a modern interface standpoint, not features) one can get a pretty good kickstart by using something like…

>or you need to create a full blown plugin yourself, which is not a small task

That is what I thought when was motivating myself to continue diving into vim and emacs. In the end it turned out that the this this problem of "difficult extensibility" exists only in my head but not in VSCode or IntelliJ IDEA. Eventually, you can do magic on your files with sed/python/any other language in terminal and this most likely is better solution because it is editor-agnostic and good for automation.

Re: 916 Days of Emacs

#217
post #91
post #75

Earlier quoted context omitted.

Emacs is an operating system, not an editor; I'm really not sure why Stallman constantly promoted the "emacs vs. vi" meme. You might as well try to switch from Notepad to Linux. It's just a type error, and you'll have a bad time.

> Emacs is an operating system, not an editor what does it take for this tired and false meme to die?

Why do you think it's false?

Emacs is an interactive lisp environment with at text-oriented interface. Text editing is simply another lisp program that manipulates the interface to work well for this specific task.

Emacs also has a built in email client, RSS reader, IRC client, calculator, file browser, web browser, markup language, regex DSL, Vim emulator, terminal emulator, custom elisp based shell, interactive REPL that works for several programming languages, and probably at least 200 more things that I don't even realize exist yet.

I think this makes it much more than just a text editor for sure. I don't know what you want to call it but operating system doesn't seem too far off the mark even if it's a little hyperbolic.

Re: 916 Days of Emacs

#218

Earlier quoted context omitted.

Hm, I've had luck with openai gpt4. I've had it make fake APIs before, but usually when I say "fooFakeApi doesn't exist" it corrects itself.

But how well does it do on elisp?

It actually helped me create a lot of completion examples when I knew very little about completing read.

It disobeyed a bit, but here's it giving a simple example:

    ChatGPT> Show me the simplest possible example of using completing read. Code only, no explanation
    
    Sure, here's an example of using `completing-read` without any explanation:

    ```emacs-lisp
    (let ((options '("apple" "banana" "cherry" "date")))
      (completing-read "Choose an option: " options nil t))
    ``` 

    This code defines a list of options called `options`. The `completing-read` function is then used to prompt the user to choose an option from the list. The first argument to `completing-read` is the prompt, the second argument is the list of options, and the other arguments are set to `nil` and `t` to indicate that the user can choose any option and that an exact match is not required.
Here's something a little more impressive:

    ChatGPT> Instead of options let's use the list of groups on my linux system as the list for completing read 
    
    Sure, here's an example of using `completing-read` to retrieve one of the groups on your Linux system:

    ```emacs-lisp
    (let* ((group-command "cut -d: -f1 /etc/group") ; command to list the groups
    (group-list (split-string (shell-command-to-string group-command) "\n"))) ; split the output into a list
      (completing-read "Choose a group: " group-list nil t))
    ```

    This code uses the `shell-command-to-string` function to execute a shell command (`cut -d: -f1 /etc/group`) that lists all the group names on your system. The output of the command is then split into a list of strings using `split-string` function. Finally, the `completing-read` function is used to prompt the user to choose one of the groups from the list. The first argument is the prompt string, the second argument is the list of groups, and the other arguments are set to `nil` and `t` to indicate that the user can choose any group and that an exact match is not required.
Now something a little less boring:

    ChatGPT> when a group is chosen print its name in the message area 
    
    Sure, here's an example of how to print the selected group name in the message area after the user makes a selection:

    ```emacs-lisp
    (let* ((group-command "/usr/bin/cut -d: -f1 /etc/group") ; command to list the groups
    (group-data (with-temp-buffer
    (shell-command group-command (current-buffer))
    (sort (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n") #'string use cut instead of /usr/bin/cut, no explanation, code only 
    
    Sure, here it is:

    ```emacs-lisp
    (let* ((group-command "cut -d: -f1 /etc/group") ; command to list the groups
    (group-data (with-temp-buffer
    (shell-command group-command (current-buffer))
    (sort (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n") #'string instead of printing the name to the message area search duckduckgo for that group 
    
    Sure, here's an example of how to search DuckDuckGo for the selected group name using Emacs' built-in `browse-url` function:

    ```emacs-lisp
    (defun my-search-group (group-name)
      (browse-url (format "https://duckduckgo.com/?q=%s" group-name)))

    (let* ((group-command "cut -d: -f1 /etc/group") ; command to list the groups
    (group-data (with-temp-buffer
    (shell-command group-command (current-buffer))
    (sort (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n") #'string
That last one is pretty cool if you didn't know how to do it in emacs before I think.

Re: 916 Days of Emacs

#219
post #58

Earlier quoted context omitted.

> some glaring issues - tramp being a major one. It’s slow and very unreliable. Over SSH? Did you turn on ssh connection sharing in ssh config? > ControlMaster auto > ControlPersist yes > ControlPath /tmp/ssh-%u-%r@%h:%p massive speedup when you do this, otherwise it starts a new connection for every operation.

Yes, and it's not that it's just slow, it also freezes Emacs completely when it borks (and it does bork). I also found that none of the emacs terminals could correctly display my prompt and I ended up writing a bunch of bash conditionals to make my prompt dumber to work in Emacs. Just worked out of the box with Vim's :term.

A common thing people run into with Emacs is using the "shell" under the impression that it's a terminal emulator. You want "term" for a proper terminal emulator that can handle fancy terminal stuff. The "term" terminal emulator can even run TUI stuff like nano, and even vim itself!

Re: 916 Days of Emacs

#220

Earlier quoted context omitted.

But how well does it do on elisp?

When I've informed it of fake APIs, it apologizes, and replaces it with another fake API.

Yes. It gave me quite a lot of trouble when I asked it to replace "cut -d:" with pure elisp. Eventually after a few minutes I got it to work, but during real work I probably would have just written it myself if something so simple didn't work the first time I asked.

Here's the log:

    ChatGPT> Replace the cut shell command with a pure elisp implementation in this code:

    (let* ((group-command "cut -d: -f1 /etc/group") ; command to list the groups
    (group-data (with-temp-buffer
    (shell-command group-command (current-buffer))
    (sort (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n") #'string
    (let* ((group-command "cut -d: -f1 /etc/group") ; command to list the groups
    (group-data (sort (split-string (with-output-to-string
          (call-process-shell-command group-command nil standard-output))
        "\n")
         #'string replace group-command with and call-process-shell-command with elisp that does the same 
    
    (setq group-command "cut -d: -f1 /etc/group")
    (setq group-data (sort (split-string (shell-command-to-string group-command) "\n") #'string What is the elisp equivalent of: cut -d: -f1 /etc/group
    
    The equivalent Elisp code for `cut -d: -f1 /etc/group` is:

    (concat
     (nth 0 (split-string (with-temp-buffer
       (insert-file-contents "/etc/group")
       (buffer-string))
     "\n"))
     ":")

    ChatGPT> Give me elisp I can evaluate to check that the elisp you gave is equal to the cut call 
    
    You can evaluate the following Elisp code to check that the Elisp I provided is equal to the `cut` call:

    (equal
     (concat
      (nth 0 (split-string (with-temp-buffer
        (insert-file-contents "/etc/group")
        (buffer-string))
      "\n"))
      ":")
     (shell-command-to-string "cut -d: -f1 /etc/group"))

    ChatGPT> It's not equal. the cut shell command gave a list of results. The elisp you gave only gives one result 
    
    I apologize for the confusion. You're right, the Elisp code I provided only returns the first entry in `/etc/group`.

    Here's the updated code to get all group names from `/etc/group` file separated by a newline:

    (with-temp-buffer
      (insert-file-contents "/etc/group")
      (let ((groups (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n")))
 (mapconcat #'(lambda (group)
   (car (split-string group ":")))
     groups
     "\n"))) 

    When you evaluate this Elisp code, it will return all the group names separated by a newline character, as the `cut -d: -f1 /etc/group` command would.

    ChatGPT> Give me elisp to check the equality of it 
    
    You can use the following Elisp code to check the equality of the two commands:

    (equal
     (with-temp-buffer
       (insert-file-contents "/etc/group")
       (let ((groups (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n")))
  (mapconcat #'(lambda (group)
    (car (split-string group ":")))
      groups
      "\n")))
     (shell-command-to-string "cut -d: -f1 /etc/group"))
Post reply on HN