Skip to content

Instantly share code, notes, and snippets.

@QiangF
Last active May 27, 2022 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QiangF/706e6b103c668e87b8ae79fdc76700ea to your computer and use it in GitHub Desktop.
Save QiangF/706e6b103c668e87b8ae79fdc76700ea to your computer and use it in GitHub Desktop.
Bookmark+ issue
Debugger entered--setting outline-regexp in buffer null to ";;;\\(;* [^ \11\n]\\|###autoload\\)\\|(":
(debug--implement-debug-watch outline-regexp ";;;\\(;* [^ \11\n]\\|###autoload\\)\\|(" set #<buffer null>)
(lisp-mode-variables nil t nil)
(lisp-data-mode)
(emacs-lisp-mode)
(custom-save-all)
(customize-save-variable bmkp-last-as-first-bookmark-file "~/.emacs.d/bookmarks")
(progn (customize-save-variable 'bmkp-last-as-first-bookmark-file file-to-save))
(if (and bmkp-last-as-first-bookmark-file bookmark-save-flag) (progn (customize-save-variable 'bmkp-last-as-first-bookmark-file file-to-save)))
(let ((file-to-save (cond (file) (parg (bmkp-read-bookmark-file-name "File to save bookmarks in: " nil (bmkp-read-bookmark-file-default))) ((not parg) bmkp-current-bookmark-file)))) (if (file-directory-p file-to-save) (progn (error "`%s' is a directory, not a file" file-to-save))) (if (and bmkp-last-as-first-bookmark-file bookmark-save-flag) (progn (customize-save-variable 'bmkp-last-as-first-bookmark-file file-to-save))) (bookmark-write-file file-to-save))
(bookmark-save)
(progn (bookmark-save))
(if (bookmark-time-to-save-p) (progn (bookmark-save)))
(bmkp-maybe-save-bookmarks)
(let ((bname (copy-sequence bookmark-name)) bmk) (if nil nil (set-text-properties 0 (length bname) nil bname)) (if (or no-overwrite (not (setq bmk (bmkp-get-bookmark-in-alist bname 'NOERROR)))) (setq bookmark-alist (cons (setq bmk (cons bname data)) bookmark-alist)) (bookmark-set-name bmk bname) (setcdr bmk data)) (put-text-property 0 (length bname) 'bmkp-full-record bmk bname) (bmkp-maybe-save-bookmarks) (if (memq bmk bmkp-modified-bookmarks) nil (setq bmkp-modified-bookmarks (cons bmk bmkp-modified-bookmarks))) (if (and (boundp 'bmkp-setting-auto-idle-bmk-p) (not (memq bmk bmkp-auto-idle-bookmarks))) (progn (setq bmkp-auto-idle-bookmarks (cons bmk bmkp-auto-idle-bookmarks)))) (setq bookmark-current-bookmark bname) (if no-refresh-p nil (bmkp-refresh/rebuild-menu-list bmk no-msg-p)) bmk)
(bookmark-store "000000355 0.30.inp" ((filename . "/tmp/ale/0.30.inp") (buffer-name . "0.30.inp") (front-context-string . "*INITIAL CONDITI") (rear-context-string . ",0.01,0.5,0.1\n\n\n") (front-context-region-string) (rear-context-region-string) (visits . 0) (time 25228 19525 242182 131000) (created 25228 19525 242182 131000) (position . 355)) nil nil t)
(let* ((record (bookmark-make-record)) (defname (cond ((and (eq major-mode 'eww-mode) (fboundp 'bmkp-make-eww-record) (bmkp-eww-title))) ((eq major-mode 'w3m-mode) w3m-current-title) ((eq major-mode 'gnus-summary-mode) (elt (let (...) (progn ...)) 1)) ((memq major-mode '(Man-mode woman-mode)) (buffer-substring (point-min) (save-excursion (goto-char ...) (skip-syntax-forward "^ ") (point)))) (t nil))) (defname (and defname (bmkp-replace-regexp-in-string "\n" " " defname))) (bname (or name (bmkp-completing-read-lax "Set bookmark" (bmkp-new-bookmark-default-names defname) (and (or (not parg) (consp parg)) (bmkp-specific-buffers-alist-only)) nil 'bookmark-history (or (not parg) (consp parg)))))) (if (and (string= bname "") defname) (progn (setq bname defname))) (while (string= "" bname) (message "Enter a NON-EMPTY bookmark name") (sit-for 2) (setq bname (bmkp-completing-read-lax "Set bookmark" (bmkp-new-bookmark-default-names defname) (and (or (not parg) (consp parg)) (bmkp-specific-buffers-alist-only)) nil 'bookmark-history (or (not parg) (consp parg))))) (let ((old-bmk (bmkp-get-bookmark-in-alist bname 'NOERROR)) old-prop) (if (and interactivep bmkp-bookmark-set-confirms-overwrite-p (atom parg) old-bmk (not (y-or-n-p (format "Overwrite bookmark `%s'? " bname)))) (progn (error "OK, canceled"))) (if old-bmk (progn (let ((--dolist-tail-- bmkp-properties-to-keep) prop) (while --dolist-tail-- (setq prop (car --dolist-tail--)) (bookmark-prop-set record prop (bookmark-prop-get old-bmk prop)) (setq --dolist-tail-- (cdr --dolist-tail--))))))) (bookmark-store bname (cdr record) (consp parg) no-refresh-p (not interactivep)) (if (and interactivep bmkp-prompt-for-tags-flag) (progn (bmkp-add-tags bname (bmkp-read-tags-completing) 'NO-UPDATE-P))) (let* ((temp (and (boundp 'bmkp-auto-light-when-set) bmkp-auto-light-when-set))) (cond ((eql temp 'autonamed-bookmark) (if (bmkp-autonamed-bookmark-p bname) (progn (bmkp-light-bookmark bname)))) ((eql temp 'non-autonamed-bookmark) (if (bmkp-autonamed-bookmark-p bname) nil (bmkp-light-bookmark bname))) ((eql temp 'any-bookmark) (bmkp-light-bookmark bname)) ((eql temp 'autonamed-in-buffer) (bmkp-light-bookmarks (bmkp-autonamed-this-buffer-alist-only) nil interactivep)) ((eql temp 'non-autonamed-in-buffer) (bmkp-light-bookmarks (bmkp-remove-if #'bmkp-autonamed-this-buffer-bookmark-p (bmkp-this-buffer-alist-only)) nil interactivep)) ((eql temp 'all-in-buffer) (bmkp-light-this-buffer nil interactivep)))) (if bmkp-autotemp-all-when-set-p (bmkp-make-bookmark-temporary bname) (catch 'bookmark-set (let ((--dolist-tail-- bmkp-autotemp-bookmark-predicates) pred) (while --dolist-tail-- (setq pred (car --dolist-tail--)) (if (and (functionp pred) (funcall pred bname)) (progn (bmkp-make-bookmark-temporary bname) (throw ... t))) (setq --dolist-tail-- (cdr --dolist-tail--)))))) (run-hooks 'bmkp-after-set-hook) (if bookmark-use-annotations (bookmark-edit-annotation bname) (goto-char bookmark-current-point)))
(progn (bookmark-maybe-load-default-file) (setq bookmark-current-point (point)) (if (and bookmark-yank-point bookmark-current-buffer) nil (save-excursion (skip-chars-forward " ") (setq bookmark-yank-point (point))) (setq bookmark-current-buffer (current-buffer))) (let* ((record (bookmark-make-record)) (defname (cond ((and (eq major-mode ...) (fboundp ...) (bmkp-eww-title))) ((eq major-mode 'w3m-mode) w3m-current-title) ((eq major-mode 'gnus-summary-mode) (elt (let ... ...) 1)) ((memq major-mode '...) (buffer-substring (point-min) (save-excursion ... ... ...))) (t nil))) (defname (and defname (bmkp-replace-regexp-in-string "\n" " " defname))) (bname (or name (bmkp-completing-read-lax "Set bookmark" (bmkp-new-bookmark-default-names defname) (and (or ... ...) (bmkp-specific-buffers-alist-only)) nil 'bookmark-history (or (not parg) (consp parg)))))) (if (and (string= bname "") defname) (progn (setq bname defname))) (while (string= "" bname) (message "Enter a NON-EMPTY bookmark name") (sit-for 2) (setq bname (bmkp-completing-read-lax "Set bookmark" (bmkp-new-bookmark-default-names defname) (and (or (not parg) (consp parg)) (bmkp-specific-buffers-alist-only)) nil 'bookmark-history (or (not parg) (consp parg))))) (let ((old-bmk (bmkp-get-bookmark-in-alist bname 'NOERROR)) old-prop) (if (and interactivep bmkp-bookmark-set-confirms-overwrite-p (atom parg) old-bmk (not (y-or-n-p (format "Overwrite bookmark `%s'? " bname)))) (progn (error "OK, canceled"))) (if old-bmk (progn (let ((--dolist-tail-- bmkp-properties-to-keep) prop) (while --dolist-tail-- (setq prop ...) (bookmark-prop-set record prop ...) (setq --dolist-tail-- ...)))))) (bookmark-store bname (cdr record) (consp parg) no-refresh-p (not interactivep)) (if (and interactivep bmkp-prompt-for-tags-flag) (progn (bmkp-add-tags bname (bmkp-read-tags-completing) 'NO-UPDATE-P))) (let* ((temp (and (boundp 'bmkp-auto-light-when-set) bmkp-auto-light-when-set))) (cond ((eql temp 'autonamed-bookmark) (if (bmkp-autonamed-bookmark-p bname) (progn (bmkp-light-bookmark bname)))) ((eql temp 'non-autonamed-bookmark) (if (bmkp-autonamed-bookmark-p bname) nil (bmkp-light-bookmark bname))) ((eql temp 'any-bookmark) (bmkp-light-bookmark bname)) ((eql temp 'autonamed-in-buffer) (bmkp-light-bookmarks (bmkp-autonamed-this-buffer-alist-only) nil interactivep)) ((eql temp 'non-autonamed-in-buffer) (bmkp-light-bookmarks (bmkp-remove-if #'bmkp-autonamed-this-buffer-bookmark-p (bmkp-this-buffer-alist-only)) nil interactivep)) ((eql temp 'all-in-buffer) (bmkp-light-this-buffer nil interactivep)))) (if bmkp-autotemp-all-when-set-p (bmkp-make-bookmark-temporary bname) (catch 'bookmark-set (let ((--dolist-tail-- bmkp-autotemp-bookmark-predicates) pred) (while --dolist-tail-- (setq pred (car --dolist-tail--)) (if (and ... ...) (progn ... ...)) (setq --dolist-tail-- (cdr --dolist-tail--)))))) (run-hooks 'bmkp-after-set-hook) (if bookmark-use-annotations (bookmark-edit-annotation bname) (goto-char bookmark-current-point))))
(unwind-protect (progn (bookmark-maybe-load-default-file) (setq bookmark-current-point (point)) (if (and bookmark-yank-point bookmark-current-buffer) nil (save-excursion (skip-chars-forward " ") (setq bookmark-yank-point (point))) (setq bookmark-current-buffer (current-buffer))) (let* ((record (bookmark-make-record)) (defname (cond ((and ... ... ...)) ((eq major-mode ...) w3m-current-title) ((eq major-mode ...) (elt ... 1)) ((memq major-mode ...) (buffer-substring ... ...)) (t nil))) (defname (and defname (bmkp-replace-regexp-in-string "\n" " " defname))) (bname (or name (bmkp-completing-read-lax "Set bookmark" (bmkp-new-bookmark-default-names defname) (and ... ...) nil 'bookmark-history (or ... ...))))) (if (and (string= bname "") defname) (progn (setq bname defname))) (while (string= "" bname) (message "Enter a NON-EMPTY bookmark name") (sit-for 2) (setq bname (bmkp-completing-read-lax "Set bookmark" (bmkp-new-bookmark-default-names defname) (and (or ... ...) (bmkp-specific-buffers-alist-only)) nil 'bookmark-history (or (not parg) (consp parg))))) (let ((old-bmk (bmkp-get-bookmark-in-alist bname 'NOERROR)) old-prop) (if (and interactivep bmkp-bookmark-set-confirms-overwrite-p (atom parg) old-bmk (not (y-or-n-p ...))) (progn (error "OK, canceled"))) (if old-bmk (progn (let (... prop) (while --dolist-tail-- ... ... ...))))) (bookmark-store bname (cdr record) (consp parg) no-refresh-p (not interactivep)) (if (and interactivep bmkp-prompt-for-tags-flag) (progn (bmkp-add-tags bname (bmkp-read-tags-completing) 'NO-UPDATE-P))) (let* ((temp (and (boundp ...) bmkp-auto-light-when-set))) (cond ((eql temp 'autonamed-bookmark) (if (bmkp-autonamed-bookmark-p bname) (progn ...))) ((eql temp 'non-autonamed-bookmark) (if (bmkp-autonamed-bookmark-p bname) nil (bmkp-light-bookmark bname))) ((eql temp 'any-bookmark) (bmkp-light-bookmark bname)) ((eql temp 'autonamed-in-buffer) (bmkp-light-bookmarks (bmkp-autonamed-this-buffer-alist-only) nil interactivep)) ((eql temp 'non-autonamed-in-buffer) (bmkp-light-bookmarks (bmkp-remove-if ... ...) nil interactivep)) ((eql temp 'all-in-buffer) (bmkp-light-this-buffer nil interactivep)))) (if bmkp-autotemp-all-when-set-p (bmkp-make-bookmark-temporary bname) (catch 'bookmark-set (let ((--dolist-tail-- bmkp-autotemp-bookmark-predicates) pred) (while --dolist-tail-- (setq pred ...) (if ... ...) (setq --dolist-tail-- ...))))) (run-hooks 'bmkp-after-set-hook) (if bookmark-use-annotations (bookmark-edit-annotation bname) (goto-char bookmark-current-point)))) (setq bookmark-yank-point nil bookmark-current-buffer nil))
(bookmark-set "000000355 0.30.inp")
(let ((bmk-name (funcall bmkp-autoname-bookmark-function position)) (mark-active nil)) (bookmark-set bmk-name) (if msg-p (progn (message "Set bookmark `%s'" bmk-name))))
(bmkp-set-autonamed-bookmark 355)
(if (not number) (bmkp-set-autonamed-bookmark (line-beginning-position)) (save-excursion (goto-char (point-min)) (let ((inhibit-field-text-motion t)) (bmkp-set-autonamed-bookmark (line-beginning-position number)))))
(bmkp-set-autonamed-bookmark-at-line)
(funcall bmkp-set-autonamed-bookmark-at-line)
(let ((bmkp-setting-auto-idle-bmk-p t)) (funcall bmkp-auto-idle-bookmark-mode-set-function))
(progn (let ((bmkp-setting-auto-idle-bmk-p t)) (funcall bmkp-auto-idle-bookmark-mode-set-function)))
(if (and bmkp-auto-idle-bookmark-mode (bmkp-not-near-other-auto-idle-bmks)) (progn (let ((bmkp-setting-auto-idle-bmk-p t)) (funcall bmkp-auto-idle-bookmark-mode-set-function))))
(when (and bmkp-auto-idle-bookmark-mode (bmkp-not-near-other-auto-idle-bmks)) (let ((bmkp-setting-auto-idle-bmk-p t)) (funcall bmkp-auto-idle-bookmark-mode-set-function)))
((lambda nil (when (and bmkp-auto-idle-bookmark-mode (bmkp-not-near-other-auto-idle-bmks)) (let ((bmkp-setting-auto-idle-bmk-p t)) (funcall bmkp-auto-idle-bookmark-mode-set-function)))))
(apply (lambda nil (when (and bmkp-auto-idle-bookmark-mode (bmkp-not-near-other-auto-idle-bmks)) (let ((bmkp-setting-auto-idle-bmk-p t)) (funcall bmkp-auto-idle-bookmark-mode-set-function)))) nil)
(timer-event-handler [t 0 15 0 REPEAT (lambda nil (when (and bmkp-auto-idle-bookmark-mode (bmkp-not-near-other-auto-idle-bmks)) (let ((bmkp-setting-auto-idle-bmk-p t)) (funcall bmkp-auto-idle-bookmark-mode-set-function)))) nil idle 0 nil])
(setup (:pkg bookmark+-lit)
(require 'bookmark+-lit)
(setq bmkp-auto-light-when-set 'any-bookmark)
(setq bmkp-auto-light-when-jump 'any-bookmark))
(setup (:pkg bookmark+)
(:delay 5)
(:option bookmark-version-control t
bmkp-last-as-first-bookmark-file "~/.emacs.d/bookmarks"
bmkp-auto-idle-bookmark-mode-delay 15
bmkp-auto-idle-bookmark-min-distance 250
bmkp-save-new-location-flag t
;; auto-save bookmarks
bookmark-save-flag 1)
(:autoload bmkp-turn-on-auto-idle-bookmark-mode hydra-bookmark/body)
(:global* "C-c SPC" #'bmkp-set-autonamed-bookmark
"M-]" #'bmkp-next-bookmark-this-file/buffer-repeat
"M-[" #'bmkp-previous-bookmark-this-file/buffer-repeat
"<C-right>" #'bmkp-next-bookmark-this-file/buffer-repeat
"<C-left>" #'bmkp-previous-bookmark-this-file/buffer-repeat)
(:when-loaded
(add-to-list 'bmkp-desktop-no-save-vars 'bmkp-auto-idle-bookmarks)
(defhydra hydra-bookmark (:color pink)
("<escape>" nil "exit")
("C-a" bmkp-annotate-bookmark "add annotation")
("C-d" bmkp-set-desktop-bookmark "bookmark desktop")
("C-s" bookmark-bmenu-show-all-annotations "show annotation")
("C-t" bmkp-toggle-autonamed-bookmark-set/delete "set/delete automatic bookmark")
("C-l" bookmark-bmenu-list "list all")
("C-n" bmkp-next-bookmark-this-file/buffer-repeat "next in buffer")
("C-p" bmkp-previous-bookmark-this-file/buffer-repeat "previous in buffer")
("C-h" my-toggle-highlight "toggle highlight in buffer")
("C-f" bmkp-switch-bookmark-file-create "switch file"))
(defvar my-bmkp-toggle nil
"Keeps the state of how the bookmark was last toggled by TABing.")
(defun my-toggle-highlight ()
(interactive)
(if my-bmkp-toggle
(bmkp-unlight-bookmarks-this-buffer) (bmkp-light-bookmarks-this-buffer))
(setq my-bmkp-toggle (not my-bmkp-toggle)))
(bmkp-turn-on-auto-idle-bookmark-mode)))
(setup outline
(:global "<S-left>" #'outline-promote
"<S-right>" #'outline-demote
"M-C--" #'outline-hide-sublevels)
(:autoload my-outline-cycle my-outline-set)
(:with-feature outline-minor-mode
(:hook-into text-mode prog-mode)
(:hook my-outline-set))
(:when-loaded
(defun my-outline-set ()
"custom heading for all progn mode, heading must ends in
outline-heading-end-regexp,which is : for python mode
* in heading to differentiate from comment, custom heading has higher level "
(when (and (not (equal major-mode 'org-mode)) comment-start)
(make-local-variable 'my-outline-regexp)
(make-local-variable 'my-outline-max-level)
(setq my-outline-max-level 8)
(let ((my-heading-start comment-start))
(setq my-outline-regexp (concat (regexp-quote my-heading-start) "[*]\\{1,8\\}"))
(setq outline-heading-alist (list)) ;; make outline promote work
(let ((level 0)
(level-prefix my-heading-start))
(while (< level my-outline-max-level)
(setq outline-heading-alist (cons (cons level-prefix level) outline-heading-alist)
level (1+ level)
level-prefix (concat level-prefix "*")))
(setq outline-heading-alist (nreverse outline-heading-alist)))
(setq outline-regexp (concat my-outline-regexp "\\|" outline-regexp)
outline-level (lambda ()
(let* ((data (match-data))
(start (car data))
(end (cadr data))
(level (- end start)))
(if (looking-at my-outline-regexp)
(- level 2) ;; subtract two spaces
(+ level my-outline-max-level)) ;; 8 is the maximum custom heading levels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment