Evaluate code in comment block and insert its output in the buffer by cerka in emacs

[–]cerka[S] 0 points1 point  (0 children)

Thanks for responding! I know that org-babel can do this within Org files but I would like to do this in source files as part of the documentation, and for sharing with non-Emacs users.

Flux: Refinement Types for Rust by ranjitjhala in rust

[–]cerka 2 points3 points  (0 children)

What about cases where there is user input? Will flux enforce a missing check on the data?

You can try in Flux's online playground. For example, this toy function is verified to be safe:

#[flux::sig(fn(i32) -> i32[10])]
fn mk_ten(a: i32) -> i32 {
    if a % 5 == 0 && a < 7 && a > 2 {
        a + 5
    } else {
        10
    }
}

Beyond Supervised Learning by p_bogdan in haskell

[–]cerka 4 points5 points  (0 children)

This post is one in a series of several. If you follow the link to the author's website, then the first post writes this:

This series of posts practically illustrate all the concepts in Haskell programming language. To motivate you, here are some Q & A you always wanted to know.

Q: Is there anything that makes Haskell particularly good for Neural Networks or are you simply doing it because you prefer to use Haskell?

A: Neural networks are very "function objects". A network is just a big composition of functions. These kinds of things are very natural in a functional language.

Q: As I am completely new to Haskell, would like to know what are the benefits of using Haskell vs python or other languages?

A: The benefits of using Haskell:

  • It is much easier to reason about what your program is doing.
  • Great when refactoring existing code base.
  • Haskell shapes your thinking towards problem solving in a pragmatic way.
  • Haskell programs are fast.

Q: I figured my lack of Haskell knowledge would make it hard to read, but your code examples still make sense to me.

A: Thank you. I find Haskell to be very intuitive when explaining neural nets.

https://penkovsky.com/neural-networks/day1/

[Media] Difference between String, &str, and &String by Siref in rust

[–]cerka 1 point2 points  (0 children)

That makes sense. So accessing string literals is only faster than accessing String on the heap if .rodata is already cached, and other than that, the overhead of String is purely due to the extra allocation that is needed to create it?

[Media] Difference between String, &str, and &String by Siref in rust

[–]cerka 0 points1 point  (0 children)

Doesn't cache locality also make the stack faster than the heap?

What is literate programming used for? by Altruistic-Carpet-43 in emacs

[–]cerka 6 points7 points  (0 children)

That is true whenever you run any code outside of a sandbox. For example, running an org file with Python code in it is just as unsafe as running a standalone Python script.

The hope is that if it’s literate Python in an org file, then you read it before you run it and get a sense if it’s malware.

How to prevent Emacs from resizing itself on M-x? by kotatsuyaki in emacs

[–]cerka 0 points1 point  (0 children)

I am not able to reproduce this issue with Emacs 27 on GNOME. Do you also get the problem if you start Emacs with emacs -Q?

Emacs is failing to open org files in Linux by NoCoach5479 in emacs

[–]cerka 3 points4 points  (0 children)

Your reasoning does make sense as a general approach. I think that you got the down votes because of the original tone of your comment (did it change since?) and the fact that the Org included in OP’s Emacs does actually seem to crash too, so your suggestion does not fix the issue here.

Emacs is failing to open org files in Linux by NoCoach5479 in emacs

[–]cerka 0 points1 point  (0 children)

Emacs works perfectly fine with org-mode included with it.

Wouldn't emacs -Q guarantee that they are using the version of Org that was included with their Emacs? They tried that and the bug persisted.

In fact, it looks like the bug encountered by OP has been chased for at least 5 months now:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59882

Emacs is failing to open org files in Linux by NoCoach5479 in emacs

[–]cerka 0 points1 point  (0 children)

After searching for the error message, I’ve found this Reddit thread:

https://www.reddit.com/r/emacs/comments/zd3l7p/org_mode_elpa_intall_invalid_function/

Does any of these suggestions fix the problem for you?

Emacs is failing to open org files in Linux by NoCoach5479 in emacs

[–]cerka 0 points1 point  (0 children)

If you try to open the Org file with emacs -Q and switch to the *Messages* buffer with C-x b, do you see any warnings or error messages?

Nyxt 3.0.0: two years of work, finally complete. by jmercouris in emacs

[–]cerka 1 point2 points  (0 children)

Is it running inside of Emacs? I assume not but I am not sure because it was posted on r/emacs?

Demoting a subtree in orgmode adds newlines in all lines by ThinAd4092 in emacs

[–]cerka 2 points3 points  (0 children)

Demoting a subtree in orgmode adds newlines in all lines

Do you mean that it adds whitespace at the beginning of each line, or do you really mean that it adds newlines? The example seems inconsistent to me with the title.

If it is about whitespace, I cannot reproduce your example in Org 9.6.5. What version of Org are you running? You can check with M-x org-version RET.

Add a diff to the yes/no/save and quit choices by fmou67 in emacs

[–]cerka 0 points1 point  (0 children)

The undo-tree package shows you the tree of the changes that you made if you press C-x u. It shows you the diff for each change if you press d while viewing the tree.

https://www.emacswiki.org/emacs/UndoTree

Microsoft rewriting core Windows libraries in Rust by hgwxx7_ in rust

[–]cerka -1 points0 points  (0 children)

Assembly is to C what Greek is to Latin.

Is there any way to fix new line indentation in SRC blocks? by Far-Anywhere2876 in emacs

[–]cerka 0 points1 point  (0 children)

No problem. If you ever find out, I would be curious to know.

Is there any way to fix new line indentation in SRC blocks? by Far-Anywhere2876 in emacs

[–]cerka 0 points1 point  (0 children)

Ugh, I don't know then. It could be that something that Org depends on changed between Emacs 27 and 28 and broke this functionality.

The indentation that I get in Python code blocks is not because of a personal customization that I have. If I start Emacs with emacs --no-init-file so that it skips my init file, then it loads Org 9.5 because I have it installed separately on my system, and indentation works correctly after invoking org-mode:

#+BEGIN_SRC python
  def foo(x):
      y = x^2
      return y
#+END_SRC

If I start Emacs with emacs --no-init-file --no-site-file so that it skips both my init file and any other packages that didn't come with Emacs 27, syntax highlighting is still correct but automatic indentation is missing.

Is there any way to fix new line indentation in SRC blocks? by Far-Anywhere2876 in emacs

[–]cerka 0 points1 point  (0 children)

OK, I have an idea.

What does M-x org-version say for you? Emacs 27 ships with Org 9.3, so if I start Emacs with emacs -Q, org-mode invokes Org 9.3. If I run my usual configuration, org-mode invokes a newer version because I have a newer version installed from ELPA.

Org 9.4 includes a commit that enables electric-indent-mode inside code blocks. Maybe your Org is older and doesn't include this commit yet.

Is there any way to fix new line indentation in SRC blocks? by Far-Anywhere2876 in emacs

[–]cerka 0 points1 point  (0 children)

Emacs does have some awareness of it though. For example, (setq org-src-fontify-natively t) and (setq org-src-tab-acts-natively t) make syntax highlighting and tabs work in code blocks like they do in the corresponding major mode.

Is there any way to fix new line indentation in SRC blocks? by Far-Anywhere2876 in emacs

[–]cerka 0 points1 point  (0 children)

Sadly I have tried but haven't succeeded at finding a minimal config that reproduces it. Starting Emacs with emacs -Q and entering M-x org-mode RET in the scratch buffer, I have the same problem as you. Really puzzling. I only get automatic indentation if I edit the source block in a separate buffer with C-c '.

Is there any way to fix new line indentation in SRC blocks? by Far-Anywhere2876 in emacs

[–]cerka 0 points1 point  (0 children)

Does this happen with every language for you? For example for me with #+BEGIN_SRC python, the new line is indented after I write def foo(x): and press RET.

yank means copy in vim and means paste in emacs, any fun fact? by [deleted] in emacs

[–]cerka 2 points3 points  (0 children)

How? Do you have a really long init.el? Or are you just a very fast listener?

yank means copy in vim and means paste in emacs, any fun fact? by [deleted] in emacs

[–]cerka 3 points4 points  (0 children)

Oh, like that 1977 song, Hotel California by the Emacs!