• 0 Posts
  • 9 Comments
Joined 2 years ago
cake
Cake day: March 4th, 2024

help-circle



  • As other comments have pointed out, and you already mentioned this as a possibility, this is how I would write it:

    (defun eat-more ()
      "Open a new terminal."
      (interactive)
      (eat nil t))
    

    However, given your goal of understanding commands and the buffer list better, I’ll try to explain a little better.

    The first parameter, the shell, when left nil, will use your default eat-shell, so the funcall in your current implementation is redundant. The eat-shell can be customized separately if necessary.

    The <3> or <5> or whatever suffix in the eat buffer name is actually not generated by eat itself, eat is using generate-new-buffer, which is an Emacs built-in function that relies on the C function generate-new-buffer-name.

    So what you are attempting to do is not just re-implement a feature eat already has, but a core function within Emacs itself. If you don’t rely on built-in functionality, I would argue that you are not familiarizing yourself with elisp development, you are really creating your own language.

    However, re-implementing what eat does can maybe be a good exercise, so to use the built-in function to help us, I would probably write it like something like this:

    (defun eat-more ()
      "Open a new terminal."
      (interactive)
      (require 'eat)
      (eat
       nil
       (let ((name (generate-new-buffer-name eat-buffer-name)))
         (when (string-match "<\\([[:digit:]]+\\)>" name)
           (string-to-number (match-string 1 name))))))
    

    One thing I’d like to draw attention to is the use of the variable eat-buffer-name, which is defined by eat and is customizable, so even though most people are using the default name "*eat*", this could be different for some users. However, using this variable means we need to ‘require’ the eat package first. In the simpler answer, we were relying on the fact that the (eat ...) command is autoloaded, and can be called without requiring the package first. But that isn’t true for the eat-buffer-name variable.







  • Light is generally better modeled by a wave, so I would say the wave doesn’t experience time. Photons are the smallest unit of energy that can be transferred between a light wave and a different particle. They have momentum and direction, but they don’t really travel exactly. They just mediate the force between light waves and matter.

    Worded differently, a fermion (massive particle) within an electromagnetic (light) wave with a frequency of f may absorb some multiple of h x f joules of energy, where h is a very small constant. There is no way for the wave to transfer less than hf joules to the particle at a time. There is no need to think of photons as anything other than the smallest possible quantization of the electromagnetic wave rather than a particle of light. There’s no need to think of it existing for any amount of time or space.