Ivan Andrus  committed 310e309

Added unlocks slot and advanced achievements

  • Participants
  • Parent commits acf9184
  • Branches default

Comments (0)

Files changed (4)

File achievements.el

 ;;; Code:
-;; TODO: Make an `unlocks' attribute so that using org-mode will (require 'org-achievements)
 ;; TODO: easy way to show a random unearned achievement, perhaps on an idle timer
 (require 'cl)
         (incf total points)
         (when (achievements-earned-p achievement)
           (incf score points)
+          (when (emacs-achievement-unlocks achievement)
+            (require (emacs-achievement-unlocks achievement) nil t))
           (unless (emacs-achievement-transient achievement)
             (setf (emacs-achievement-predicate achievement) t)))))
     ;; Save the updated list of achievements

File advanced-achievements.el

+;;; advanced-achievements.el --- More advanced achievements
+;; Copyright (C) 2012  Ivan Andrus
+;; Author: Ivan Andrus <>
+;; Keywords: games
+;; 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 of the License, 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
+;; GNU General Public License for more details.
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <>.
+;;; Commentary:
+;; These are meant to be slightly more advanced achievements than
+;; basic-achievements.el and is unlocked with one of the achievements
+;; there.  Nevertheless, what counts as "advanced" is quite arbitrary.
+;;; Code:
+;;{{{ Disabled functions
+(defachievement "Inception"
+  "You have used recursive editing and exited succesfully."
+  :command '(recursive-edit exit-recursive-edit))
+(defachievement "Narrow minded"
+  "You have used narrowing."
+  :command '(narrow-to-region narrow-to-page))
+(defachievement "Forbidden Fruits"
+  "You have used all disabled commands."
+  :command (loop for s being the symbols
+                 when (get s 'disabled) collect s))
+(defachievement "Enabler"
+  "You have enabled all commands."
+  :predicate '(= 0 (length (loop for s being the symbols
+                                 when (get s 'disabled) collect s))))
+(defachievement "Case Changer"
+  "You have changed the case of a few words."
+  :command '(upcase-word downcase-word capitalize-word))
+(defachievement "CASE CHANGER"
+  "You have changed the case of vast amounts of text."
+  :command '(upcase-region downcase-region))
+(defachievement "The Great Destroyer"
+  "You have laid waste to an entire buffer in one go."
+  :command 'erase-buffer)
+(defachievement "Goal Setter"
+  "You have set the goal column."
+  :command 'set-goal-column)
+(defachievement "Wide Load"
+  "You have scrolled to see an extra wide buffer."
+  :command 'scroll-left)
+(defachievement "Dired reuse"
+  "You have reused a dired buffer to look at another file/directory."
+  :command 'dired-find-alternate-file)
+(provide 'advanced-achievements)
+;;; advanced-achievements.el ends here

File basic-achievements.el

 (defachievement "Unlocker"
   "You have earned over 50 points in Emacs achievements.  Not bad."
-  :predicate '(> achievement-score 50))
+  :predicate '(>= achievement-score 50)
+  :unlocks 'advanced-achievements)
 (defachievement "Over Achiever"
   "You have earned 500 points in Emacs achievements.  Don't you have some real work to do?"
-  :predicate '(> achievement-score 500))
+  :predicate '(>= achievement-score 500))
 (defachievement "Cheater"
   "You have earned all Emacs achievements.  Actually that's impossible."

File ideas-achievements.el

 eval-last-sexp twice to get hex numbers
 ;;{{{ Modes
   "You have used smerge-mode to resolve conflicts.")
-;;{{{ Forbidden fruits -- disabled functions
-;; (put 'narrow-to-region 'disabled nil)
-(defachievement ""
-  "You have used recursive editing.")
-(defachievement "Narrow minded"
-  "You have used narrowing.")
-;; Find all disabled commands
-(loop for s being the symbols
-      when (get s 'disabled) collect s)
 ;;{{{ Editing
 ;; unicode characters