Skip to content

Instantly share code, notes, and snippets.

@jordonbiondo
Created July 23, 2013 19:36
Show Gist options
  • Save jordonbiondo/6065464 to your computer and use it in GitHub Desktop.
Save jordonbiondo/6065464 to your computer and use it in GitHub Desktop.
modtime-skip-mode
;; Author: Jordon Biondo
;; Created: Tue Jul 23 15:35:07 2013 (-0400)
;; Version: .1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 3, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(defadvice ask-user-about-supersession-threat (around modtime/turn-it-off-ask)
"Disable the supersession threat prompt."
t)
(defadvice verify-visited-file-modtime (after modtime/turn-it-off-verify)
"Always return t."
(setq ad-return-value t))
(defun modtime/disable-checking()
"Enable outside modification checking."
(ad-disable-regexp "\\<modtime/turn-it-off-.*")
(ad-update-regexp "\\<modtime/turn-it-off-.*"))
(defun modtime/enable-checking()
"Disable outside modification checking."
(ad-enable-regexp "\\<modtime/turn-it-off-.*")
(ad-activate-regexp "\\<modtime/turn-it-off-.*")
(ad-update-regexp "\\<modtime/turn-it-off-.*"))
(define-minor-mode modtime-skip-mode
"Emacs will never think a file has been modified somewhere else."
:init-value nil
:lighter ""
:global t
(if modtime-skip-mode
(modtime/enable-checking)
(modtime/disable-checking)))
@xyzzyz
Copy link

xyzzyz commented Jul 23, 2013

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment