[syndicated profile] emacs_reddit_feed

Posted by /u/sauntcartas

I've occasionally wanted to be able to programmatically kick off an interactive regexp search and replace, with replacement text generated by Lisp code, and where I can confirm each replacement. At first blush query-replace-regexp doesn't seem to work for this purpose, since the \,(...) replacement construct only works for interactive calls. Using an artificial example of replacing digit sequences with their square roots, you can do this:

C-M-% [0-9]+ RET \,(sqrt \#&) RET

But programmatically, this doesn't work:

(query-replace-regexp "[0-9]+" "\\,(sqrt \\#&)") 

You get an error Invalid use of ‘\\’ in replacement text.

I had a short essay all typed up about my quest to get this working, but finally I noticed that the docstring for query-replace-regexp actually points in the right direction already, so I'll just cut to the chase.

When using those Lisp features interactively in the replacement text, TO-STRING is actually made a list instead of a string. Use C-x M-: after this command for details. 

After I ran the command up top, C-x M-: revealed this:

(query-replace-regexp "[0-9]+" '(replace-eval-replacement replace-quote (sqrt (string-to-number (match-string 0)))) nil (use-region-beginning) (use-region-end) nil (use-region-noncontiguous-p)) 

It seems to work the same if you remove the trailing default-looking arguments:

(query-replace-regexp "[0-9]+" '(replace-eval-replacement replace-quote (sqrt (string-to-number (match-string 0))))) 

So, there you go! You can kick off an interactive search and replace of a regexp regexp with replacement code replacement-form with:

(query-replace-regexp regexp '(replace-eval-replacement replace-quote replacement-form)) 

My original efforts led me to the internal function perform-replace which I was able to call directly like so:

(perform-replace regexp '(replace-eval-replacement replace-quote replacement-form) t t nil) 

...but it's a bit more readable to just call query-replace-regexp directly in the "correct" way.

By the way, my actual use case for this operation is to convert Chinese syllables having a trailing numeric tone to the accented spelling I'm more used to, for example, bu4 hao3 → bù hǎo for Mandarin, and faa1 hung4 → fāa hùhng for Cantonese.

submitted by /u/sauntcartas
[link] [comments]
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)
[staff profile] denise posting in [site community profile] dw_news
Back in August of 2025, we announced a temporary block on account creation for users under the age of 18 from the state of Tennessee, due to the court in Netchoice's challenge to the law (which we're a part of!) refusing to prevent the law from being enforced while the lawsuit plays out. Today, I am sad to announce that we've had to add South Carolina to that list. When creating an account, you will now be asked if you're a resident of Tennessee or South Carolina. If you are, and your birthdate shows you're under 18, you won't be able to create an account.

We're very sorry to have to do this, and especially on such short notice. The reason for it: on Friday, South Carolina governor Henry McMaster signed the South Carolina Age-Appropriate Design Code Act into law, with an effective date of immediately. The law is so incredibly poorly written it took us several days to even figure out what the hell South Carolina wants us to do and whether or not we're covered by it. We're still not entirely 100% sure about the former, but in regards to the latter, we're pretty sure the fact we use Google Analytics on some site pages (for OS/platform/browser capability analysis) means we will be covered by the law. Thankfully, the law does not mandate a specific form of age verification, unlike many of the other state laws we're fighting, so we're likewise pretty sure that just stopping people under 18 from creating an account will be enough to comply without performing intrusive and privacy-invasive third-party age verification. We think. Maybe. (It's a really, really badly written law. I don't know whether they intended to write it in a way that means officers of the company can potentially be sentenced to jail time for violating it, but that's certainly one possible way to read it.)

Netchoice filed their lawsuit against SC over the law as I was working on making this change and writing this news post -- so recently it's not even showing up in RECAP yet for me to link y'all to! -- but here's the complaint as filed in the lawsuit, Netchoice v Wilson. Please note that I didn't even have to write the declaration yet (although I will be): we are cited in the complaint itself with a link to our August news post as evidence of why these laws burden small websites and create legal uncertainty that causes a chilling effect on speech. \o/

In fact, that's the victory: in December, the judge ruled in favor of Netchoice in Netchoice v Murrill, the lawsuit over Louisiana's age-verification law Act 456, finding (once again) that requiring age verification to access social media is unconstitutional. Judge deGravelles' ruling was not simply a preliminary injunction: this was a final, dispositive ruling stating clearly and unambiguously "Louisiana Revised Statutes §§51:1751–1754 violate the First Amendment of the U.S. Constitution, as incorporated by the Fourteenth Amendment of the U.S. Constitution", as well as awarding Netchoice their costs and attorney's fees for bringing the lawsuit. We didn't provide a declaration in that one, because Act 456, may it rot in hell, had a total registered user threshold we don't meet. That didn't stop Netchoice's lawyers from pointing out that we were forced to block service to Mississippi and restrict registration in Tennessee (pointing, again, to that news post), and Judge deGravelles found our example so compelling that we are cited twice in his ruling, thus marking the first time we've helped to get one of these laws enjoined or overturned just by existing. I think that's a new career high point for me.

I need to find an afternoon to sit down and write an update for [site community profile] dw_advocacy highlighting everything that's going on (and what stage the lawsuits are in), because folks who know there's Some Shenanigans afoot in their state keep asking us whether we're going to have to put any restrictions on their states. I'll repeat my promise to you all: we will fight every state attempt to impose mandatory age verification and deanonymization on our users as hard as we possibly can, and we will keep actions like this to the clear cases where there's no doubt that we have to take action in order to prevent liability.

In cases like SC, where the law takes immediate effect, or like TN and MS, where the district court declines to issue a temporary injunction or the district court issues a temporary injunction and the appellate court overturns it, we may need to take some steps to limit our potential liability: when that happens, we'll tell you what we're doing as fast as we possibly can. (Sometimes it takes a little while for us to figure out the exact implications of a newly passed law or run the risk assessment on a law that the courts declined to enjoin. Netchoice's lawyers are excellent, but they're Netchoice's lawyers, not ours: we have to figure out our obligations ourselves. I am so very thankful that even though we are poor in money, we are very rich in friends, and we have a wide range of people we can go to for help.)

In cases where Netchoice filed the lawsuit before the law's effective date, there's a pending motion for a preliminary injunction, the court hasn't ruled on the motion yet, and we're specifically named in the motion for preliminary injunction as a Netchoice member the law would apply to, we generally evaluate that the risk is low enough we can wait and see what the judge decides. (Right now, for instance, that's Netchoice v Jones, formerly Netchoice v Miyares, mentioned in our December news post: the judge has not yet ruled on the motion for preliminary injunction.) If the judge grants the injunction, we won't need to do anything, because the state will be prevented from enforcing the law. If the judge doesn't grant the injunction, we'll figure out what we need to do then, and we'll let you know as soon as we know.

I know it's frustrating for people to not know what's going to happen! Believe me, it's just as frustrating for us: you would not believe how much of my time is taken up by tracking all of this. I keep trying to find time to update [site community profile] dw_advocacy so people know the status of all the various lawsuits (and what actions we've taken in response), but every time I think I might have a second, something else happens like this SC law and I have to scramble to figure out what we need to do. We will continue to update [site community profile] dw_news whenever we do have to take an action that restricts any of our users, though, as soon as something happens that may make us have to take an action, and we will give you as much warning as we possibly can. It is absolutely ridiculous that we still have to have this fight, but we're going to keep fighting it for as long as we have to and as hard as we need to.

I look forward to the day we can lift the restrictions on Mississippi, Tennessee, and now South Carolina, and I apologize again to our users (and to the people who temporarily aren't able to become our users) from those states.
[syndicated profile] emacs_reddit_feed

Posted by /u/nthn-d

I am writing some forth code, and find it easier to read when the characters are in uppercase. I've already wrote a minor mode that makes it so that characters are inserted in uppercase but only in Forth buffers. This solved my issue, but other people might not want to read or write in that fashion meaning they can't work with me, or I can't just clone a Forth repo and work with it without manually upcasing everything. Is there a way to make it so that the buffer's text is displayed in uppercase even though it is stored on disk and edited in the original case?

submitted by /u/nthn-d
[link] [comments]
[syndicated profile] emacs_reddit_feed

Posted by /u/argon_077

Just curious about how to get “RStudio-like” completion in Emacs, including variable/object names.

I tried C-M-i, but sometimes there is no response, or I have to choose the variable I just used in another buffer.

Are any more convenient methods? Any suggestions are appreciated!

submitted by /u/argon_077
[link] [comments]
[syndicated profile] emacs_reddit_feed

Posted by /u/skinney6

I'm running emacs 30.2 with evil and custom SPC leader keymap created with general. Maybe something in there is goofing it up.

When in elisp debugger-mode i'm not getting any of the keys from the debugger-mode-map keymap. I'm not sure how to debug this.

submitted by /u/skinney6
[link] [comments]
[syndicated profile] schneier_on_security_feed

Posted by Bruce Schneier

In 2023, the science fiction literary magazine Clarkesworld stopped accepting new submissions because so many were generated by artificial intelligence. Near as the editors could tell, many submitters pasted the magazine’s detailed story guidelines into an AI and sent in the results. And they weren’t alone. Other fiction magazines have also reported a high number of AI-generated submissions.

This is only one example of a ubiquitous trend. A legacy system relied on the difficulty of writing and cognition to limit volume. Generative AI overwhelms the system because the humans on the receiving end can’t keep up.

This is happening everywhere. Newspapers are being inundated by AI-generated letters to the editor, as are academic journals. Lawmakers are inundated with AI-generated constituent comments. Courts around the world are flooded with AI-generated filings, particularly by people representing themselves. AI conferences are flooded with AI-generated research papers. Social media is flooded with AI posts. In music, open source software, education, investigative journalism and hiring, it’s the same story.

Like Clarkesworld’s initial response, some of these institutions shut down their submissions processes. Others have met the offensive of AI inputs with some defensive response, often involving a counteracting use of AI. Academic peer reviewers increasingly use AI to evaluate papers that may have been generated by AI. Social media platforms turn to AI moderators. Court systems use AI to triage and process litigation volumes supercharged by AI. Employers turn to AI tools to review candidate applications. Educators use AI not just to grade papers and administer exams, but as a feedback tool for students.

These are all arms races: rapid, adversarial iteration to apply a common technology to opposing purposes. Many of these arms races have clearly deleterious effects. Society suffers if the courts are clogged with frivolous, AI-manufactured cases. There is also harm if the established measures of academic performance – publications and citations – accrue to those researchers most willing to fraudulently submit AI-written letters and papers rather than to those whose ideas have the most impact. The fear is that, in the end, fraudulent behavior enabled by AI will undermine systems and institutions that society relies on.

Upsides of AI

Yet some of these AI arms races have surprising hidden upsides, and the hope is that at least some institutions will be able to change in ways that make them stronger.

Science seems likely to become stronger thanks to AI, yet it faces a problem when the AI makes mistakes. Consider the example of nonsensical, AI-generated phrasing filtering into scientific papers.

A scientist using an AI to assist in writing an academic paper can be a good thing, if used carefully and with disclosure. AI is increasingly a primary tool in scientific research: for reviewing literature, programming and for coding and analyzing data. And for many, it has become a crucial support for expression and scientific communication. Pre-AI, better-funded researchers could hire humans to help them write their academic papers. For many authors whose primary language is not English, hiring this kind of assistance has been an expensive necessity. AI provides it to everyone.

In fiction, fraudulently submitted AI-generated works cause harm, both to the human authors now subject to increased competition and to those readers who may feel defrauded after unknowingly reading the work of a machine. But some outlets may welcome AI-assisted submissions with appropriate disclosure and under particular guidelines, and leverage AI to evaluate them against criteria like originality, fit and quality.

Others may refuse AI-generated work, but this will come at a cost. It’s unlikely that any human editor or technology can sustain an ability to differentiate human from machine writing. Instead, outlets that wish to exclusively publish humans will need to limit submissions to a set of authors they trust to not use AI. If these policies are transparent, readers can pick the format they prefer and read happily from either or both types of outlets.

We also don’t see any problem if a job seeker uses AI to polish their resumes or write better cover letters: The wealthy and privileged have long had access to human assistance for those things. But it crosses the line when AIs are used to lie about identity and experience, or to cheat on job interviews.

Similarly, a democracy requires that its citizens be able to express their opinions to their representatives, or to each other through a medium like the newspaper. The rich and powerful have long been able to hire writers to turn their ideas into persuasive prose, and AIs providing that assistance to more people is a good thing, in our view. Here, AI mistakes and bias can be harmful. Citizens may be using AI for more than just a time-saving shortcut; it may be augmenting their knowledge and capabilities, generating statements about historical, legal or policy factors they can’t reasonably be expected to independently check.

Fraud booster

What we don’t want is for lobbyists to use AIs in astroturf campaigns, writing multiple letters and passing them off as individual opinions. This, too, is an older problem that AIs are making worse.

What differentiates the positive from the negative here is not any inherent aspect of the technology, it’s the power dynamic. The same technology that reduces the effort required for a citizen to share their lived experience with their legislator also enables corporate interests to misrepresent the public at scale. The former is a power-equalizing application of AI that enhances participatory democracy; the latter is a power-concentrating application that threatens it.

In general, we believe writing and cognitive assistance, long available to the rich and powerful, should be available to everyone. The problem comes when AIs make fraud easier. Any response needs to balance embracing that newfound democratization of access with preventing fraud.

There’s no way to turn this technology off. Highly capable AIs are widely available and can run on a laptop. Ethical guidelines and clear professional boundaries can help – for those acting in good faith. But there won’t ever be a way to totally stop academic writers, job seekers or citizens from using these tools, either as legitimate assistance or to commit fraud. This means more comments, more letters, more applications, more submissions.

The problem is that whoever is on the receiving end of this AI-fueled deluge can’t deal with the increased volume. What can help is developing assistive AI tools that benefit institutions and society, while also limiting fraud. And that may mean embracing the use of AI assistance in these adversarial systems, even though the defensive AI will never achieve supremacy.

Balancing harms with benefits

The science fiction community has been wrestling with AI since 2023. Clarkesworld eventually reopened submissions, claiming that it has an adequate way of separating human- and AI-written stories. No one knows how long, or how well, that will continue to work.

The arms race continues. There is no simple way to tell whether the potential benefits of AI will outweigh the harms, now or in the future. But as a society, we can influence the balance of harms it wreaks and opportunities it presents as we muddle our way through the changing technological landscape.

This essay was written with Nathan E. Sanders, and originally appeared in The Conversation.

[syndicated profile] emacs_reddit_feed

Posted by /u/BigNeighborhood3952

I've been working on a modern replacement for https://github.com/iyefrat/evil-tex that uses Emacs 29+ built-in tree-sitter instead of regular expressions.

Why? The original evil-tex hasn't been updated in years, and regex-based parsing can be brittle with nested commands, comments, and complex LaTeX. Tree-sitter gives

us a proper AST, so text objects are precise and fast even on large files.

What it does:

- Text objects for commands (ic/ac), environments (ie/ae), math (im/am), delimiters (id/ad), sections (iS/aS), super/subscripts (i^/a^, i_/a_)

- Toggles (mt prefix): environment star (mte), math mode inline/display (mtm), delimiter sizing (mtd), and more

- Surround integration with evil-surround: wrap with environments, commands, math, delimiters, CDLaTeX accents

Available on MELPA: M-x package-install RET evil-tex-ts RET

GitHub: https://github.com/Prgebish/evil-tex-ts

This is the first release, so bug reports are welcome. And if you find it useful — a star on GitHub would be appreciated!

submitted by /u/BigNeighborhood3952
[link] [comments]
[syndicated profile] emacs_reddit_feed

Posted by /u/zck

When I'm writing Emacs Lisp code, Emacs will remind me of the arguments to a function or macro, as shown in the first screenshot.

However, when I'm writing Clojure code, Emacs doesn't show the same arguments. I would like it to.

I've just switched over to clojure-ts-mode, so perhaps I need to configure it differently. I had been using clojure-mode, but hadn't had that feature there either.

My current clojure-related config is as follows:

(use-package cider :bind (:map cider-mode-map ("C-<return>" . cider-find-var)) :config (unbind-key "C-c C-x" cider-mode-map) (unbind-key "C-c C-." cider-mode-map) (setq cider-save-file-on-load t) (setq cider-prompt-for-symbol nil)) (use-package clj-refactor) (use-package clojure-ts-mode :config (add-hook 'clojure-ts-mode-hook #'cider-mode)) 

How can I get the arguments put into the minibuffer for Clojure code, the same way it works for Emacs Lisp code?

submitted by /u/zck
[link] [comments]
[syndicated profile] emacs_reddit_feed

Posted by /u/AutoModerator

This is a thread for smaller, miscellaneous items that might not warrant a full post on their own.

The default sort is new to ensure that new items get attention.

If something gets upvoted and discussed a lot, consider following up with a post!

Search for previous "Tips, Tricks" Threads.

Fortnightly means once every two weeks. We will continue to monitor the mass of confusion resulting from dark corners of English.

submitted by /u/AutoModerator
[link] [comments]
[syndicated profile] emacs_reddit_feed

Posted by /u/InTheBogaloo

hihi people i want to experiment with my emacs im been using emacs with things like ido + smex nothing too fancy but how i say i want to try new things so i want to know what you recommend or what u use for a fast navegation,things like Ivy u know.

submitted by /u/InTheBogaloo
[link] [comments]

How to rebind the help prefix?

Feb. 9th, 2026 08:49 pm
[syndicated profile] emacs_reddit_feed

Posted by /u/BluFudge

Hello everyone. While I like using the usual C-h prefix; when editing a file, I'd like for C-h to be bound to backward-delete-character instead.

I'd like to know a few things:

  1. When a buffer is editable, does it have a minor mode?
  2. How do I rebind another keyboard sequence to the help prefix?

1. When a file is editable, does it have a minor mode?

I'd like the C-h to only delete characters only when the buffer is editable.

I've noticed that the view-mode minor mode and the Info major mode don't allow for editing, so I wondered if Emacs had an insert mode like vi*. I've read the Modes section of the info pages and found no such thing. I don't want to use the Fundamental mode to rebind, as that affects every other mode. Is there an insert minor mode or do I have to create my own minor mode for editable buffers?

2. How do I rebind another sequence to the help prefix?

So, while I'm still in an editable buffer, I'd like to rebind C-c C-h as the help-prefix.

I was able to do this with C-c C-u bound to the command universal-argument. I found no such command for the help-prefix, is there such a thing?

Thanks for reading.


Edit: Sorry, I realise this is kind of a stupid question, I may have gone a little down the emacs rabbit hole.

submitted by /u/BluFudge
[link] [comments]

Profile

mustashriq: (Default)
mustashriq

March 2013

S M T W T F S
     12
345 6 789
10111213141516
1718192021 2223
24252627282930
31      

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 11th, 2026 02:09 am
Powered by Dreamwidth Studios