save windows path with spaces

(defun bounds-of-string-at-point ()
  "String at point including the string delimiters."
  (when-let ((ppss (syntax-ppss))
             (in-string (nth 3 ppss))
             (b (nth 8 ppss))
             (e-ppss (save-excursion (parse-partial-sexp (1+ b) (point-max) nil nil nil 'syntax-table)))
             (e (1+ (nth 8 e-ppss))))
    (cons b e)))

(put 'string 'bounds-of-thing-at-point #'bounds-of-string-at-point)

(defun around-ad-ffap-string-at-point (oldfun &optional mode)
  "Use the string at point for `ffap-string-at-point'
or the original function if we are not within a string."
  (let ((str-bounds (bounds-of-thing-at-point 'string)))
    (if str-bounds
        (setq ffap-string-at-point
               (setcar ffap-string-at-point-region (1+ (car str-bounds)))
               (setcar (cdr ffap-string-at-point-region) (1- (cdr str-bounds)))))
      (funcall oldfun mode))))

(advice-add 'ffap-string-at-point :around #'around-ad-ffap-string-at-point)

rename this file

(defun pos-rename-current-file (newname)
  "Rename the current file to NEWNAME."
  (interactive "F")
  (let ((oldname (buffer-file-name)))
    (when oldname
      (dired-rename-file oldname newname nil))))

Popup enables pop ups used by company and many other packages. Sets also a few fallback default colors.

(use-package popup
(set-face-attribute 'popup-scroll-bar-foreground-face nil :background "#464f60" :inherit nil)
(set-face-attribute 'popup-scroll-bar-background-face nil :background "#263146" :inherit nil )
(set-face-attribute 'popup-menu-selection-face nil :inherit nil :background "#464f60" :foreground "#ffffff" )
(set-face-attribute 'popup-face nil :inherit nil :background "#263146" :foreground "#ffffff" )
; add some shotcuts in popup menu mode
(define-key popup-menu-keymap (kbd "C-i") 'popup-select)
(define-key popup-menu-keymap (kbd "C-n") 'popup-next)
(define-key popup-menu-keymap (kbd "C-p") 'popup-previous)
);end popup

tooltip configuration

Tooltip (included in emacs) popups on mouse over. When Tooltip mode is disabled, Emacs displays help text in the echo area, instead of making a pop-up window.

(set-face-attribute 'tooltip nil :inherit nil :background "gray96")
(tooltip-mode 1)

pos-tip configuration

Pos-tip allows tooltip to be located at various places in the buffer, and provides some faces

(use-package pos-tip
(setq pos-tip-foreground-color "#FFC300")
(setq pos-tip-background-color "#2471A3")
(setq pos-tip-background-color "#2471A3")
(setq pos-tip-foreground-color "#FFC300")
;(pos-tip-w32-max-width-height t)

That’s all for now…

comments powered by Disqus