From 2bc338371e8e6e3f9b3ba610ae8c6410f017dad0 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 20 Oct 2023 15:55:20 +0200 Subject: [PATCH] Remove the camel-to-snake-case function string-inflection (soon to be added) already does this for me. --- configuration.org | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/configuration.org b/configuration.org index 0f46d14..fea7856 100644 --- a/configuration.org +++ b/configuration.org @@ -399,31 +399,6 @@ Copied from http://whattheemacsd.com/editing-defuns.el-01.html (indent-for-tab-command)) #+END_SRC -*** Convert ~camelCase~ to ~snake_case~ - -#+BEGIN_SRC emacs-lisp -(defun camel-to-snake-case (arg) - "Convert a camelCase word to snake_case. - -If the prefix argument ARG is non-nil, convert the text to uppercase." - (interactive "p") - (progn - (let ((start (region-beginning)) - (end (region-end)) - (case-fold-search nil) - (had-initial-underscore nil)) - (goto-char start) - (when (looking-at "_") (setq had-initial-underscore t)) - (while (re-search-forward "\\([A-Z]\\)" end t) - (replace-match "_\\1") - (setq end (1+ end))) - (if arg - (upcase-region start end) - (downcase-region start end)) - (goto-char start) - (unless had-initial-underscore (delete-char 1))))) -#+END_SRC - *** Insert two spaces after specific characters #+BEGIN_SRC emacs-lisp