ros & regex - two headed monsters
3832 단어 Emacs
macros
there's a nice package called macrostep.el that allows on the spot macro expansion and is widely mentioned in forums and blogs; only i didn't know about it until recently do make the following change not to compilemac
(defadvice macrostep-expand (around macrostep-expand-no-compile activate)
(flet ((byte-compile (s) s))
ad-do-it))
regex
there's a builtin package called re-builder.el but it's a bit clunky to use imo even with the addition of pcre2el.el. so what i do is use anzu.el (who doesn't?) and define some operations in isearch-mode-map.
구 s와 미제 살구
(require 'anzu)
(global-anzu-mode +1)
(global-set-key [remap query-replace] 'anzu-query-replace)
(global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp)
(unless (keymap-parent lisp-mode-shared-map)
(set-keymap-parent lisp-mode-shared-map prog-mode-map))
(define-key prog-mode-map [convert] 'anzu-query-replace-at-cursor-thing)
(put 'anzu-mode-lighter 'risky-local-variable t)
(setq anzu-mode-lighter `(" " ,(propertize "杏" 'face 'anzu-mode-line)))
customize isearch
(define-key isearch-mode-map (kbd "C-S-y")
(lambda ()
"Pull string from kill ring into search string literally."
(interactive)
(setq isearch-yank-flag t)
(let ((string (current-kill 0)))
(if (eq (string-to-char string) ?\") (setq string (read string)))
(isearch-process-search-string
string
(mapconcat 'isearch-text-char-description string "")))))
(define-key isearch-mode-map [convert]
(lambda ()
"copy escaped regex string & exit"
(interactive)
(when isearch-regexp
(kill-new (format "%S" (if pcre-mode (pcre-to-elisp isearch-string) isearch-string)))
(isearch-exit))))
with that, you can paste existing regex strings into isearch and when you are satisfied with the regex hits after some edits, copy the final isearch regex string into the kill ring ready for use in font locks and regex searches .45
pcre2el
if you use pcre2el.el, maybe the following is helpful:
(require 'pcre2el)
(add-hook 'prog-mode-hook 'rxt-mode)
(setq reb-re-syntax 'pcre)
if you activate pcre-mode, the above isearch works in pcre regex. but the author of this package warns pcre-mode is experimental so use it at your own risk
Reference
이 문제에 관하여(ros & regex - two headed monsters), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/daiyanh/items/7f63c5135db4a47b37f7
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
(defadvice macrostep-expand (around macrostep-expand-no-compile activate)
(flet ((byte-compile (s) s))
ad-do-it))
there's a builtin package called re-builder.el but it's a bit clunky to use imo even with the addition of pcre2el.el. so what i do is use anzu.el (who doesn't?) and define some operations in isearch-mode-map.
구 s와 미제 살구
(require 'anzu)
(global-anzu-mode +1)
(global-set-key [remap query-replace] 'anzu-query-replace)
(global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp)
(unless (keymap-parent lisp-mode-shared-map)
(set-keymap-parent lisp-mode-shared-map prog-mode-map))
(define-key prog-mode-map [convert] 'anzu-query-replace-at-cursor-thing)
(put 'anzu-mode-lighter 'risky-local-variable t)
(setq anzu-mode-lighter `(" " ,(propertize "杏" 'face 'anzu-mode-line)))
customize isearch
(define-key isearch-mode-map (kbd "C-S-y")
(lambda ()
"Pull string from kill ring into search string literally."
(interactive)
(setq isearch-yank-flag t)
(let ((string (current-kill 0)))
(if (eq (string-to-char string) ?\") (setq string (read string)))
(isearch-process-search-string
string
(mapconcat 'isearch-text-char-description string "")))))
(define-key isearch-mode-map [convert]
(lambda ()
"copy escaped regex string & exit"
(interactive)
(when isearch-regexp
(kill-new (format "%S" (if pcre-mode (pcre-to-elisp isearch-string) isearch-string)))
(isearch-exit))))
with that, you can paste existing regex strings into isearch and when you are satisfied with the regex hits after some edits, copy the final isearch regex string into the kill ring ready for use in font locks and regex searches .45
pcre2el
if you use pcre2el.el, maybe the following is helpful:
(require 'pcre2el)
(add-hook 'prog-mode-hook 'rxt-mode)
(setq reb-re-syntax 'pcre)
if you activate pcre-mode, the above isearch works in pcre regex. but the author of this package warns pcre-mode is experimental so use it at your own risk
Reference
이 문제에 관하여(ros & regex - two headed monsters), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/daiyanh/items/7f63c5135db4a47b37f7텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)