diff --git a/ChangeLog b/ChangeLog
index 7184c8cc6a88ab284385f4a4d616229d01e5f4dc..cb090662d1b26ca923525e7e4306e92e685c70ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
 	* src/nano.c (window_init): Rename 'no_more_space()' to 'more_space()'
 	for consistency, and tweak the related comments.
 	* src/files.c: Update some comments to match the current status.
+	* src/nano (finish, main): Allow -H/--historylog and -P/--poslog to
+	function also when -I/--ignorercfiles is given.
 
 2014-06-18  Benno Schulenberg  <bensberg@justemail.net>
 	* src/text.c: Rename 'to_end' to 'to_eof', to lessen confusion
diff --git a/src/nano.c b/src/nano.c
index e93aeaf105fd9c3ff2b5eef436c487723ea2fb19..96879337faf47fe87fb89ab07cafefcc0c3557bf 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -613,9 +613,9 @@ void finish(void)
     tcsetattr(0, TCSANOW, &oldterm);
 
 #if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
-    if (!no_rcfiles && ISSET(HISTORYLOG))
+    if (ISSET(HISTORYLOG))
 	save_history();
-    if (!no_rcfiles && ISSET(POS_HISTORY)) {
+    if (ISSET(POS_HISTORY)) {
 	update_poshistory(openfile->filename, openfile->current->lineno, xplustabs() + 1);
 	save_poshistory();
     }
@@ -2410,14 +2410,16 @@ int main(int argc, char **argv)
     if (*(tail(argv[0])) == 'r')
 	SET(RESTRICTED);
 
-    /* If we're using restricted mode, disable suspending, backups, and
-     * reading rcfiles, since they all would allow reading from or
-     * writing to files not specified on the command line. */
+    /* If we're using restricted mode, disable suspending, backups,
+     * rcfiles, and history files, since they all would allow reading
+     * from or writing to files not specified on the command line. */
     if (ISSET(RESTRICTED)) {
 	UNSET(SUSPEND);
 	UNSET(BACKUP_FILE);
 #ifndef DISABLE_NANORC
 	no_rcfiles = TRUE;
+	UNSET(HISTORYLOG);
+	UNSET(POS_HISTORY);
 #endif
     }
 
@@ -2529,18 +2531,17 @@ int main(int argc, char **argv)
     /* Set up the search/replace history. */
     history_init();
 #ifndef DISABLE_NANORC
-    if (!no_rcfiles) {
-	if (ISSET(HISTORYLOG) || ISSET(POS_HISTORY)) {
-	    if (check_dotnano() == 0) {
-		UNSET(HISTORYLOG);
-		UNSET(POS_HISTORY);
-	    }
+    if (ISSET(HISTORYLOG) || ISSET(POS_HISTORY)) {
+	get_homedir();
+	if (homedir == NULL || check_dotnano() == 0) {
+	    UNSET(HISTORYLOG);
+	    UNSET(POS_HISTORY);
 	}
-	if (ISSET(HISTORYLOG))
-	    load_history();
-	if (ISSET(POS_HISTORY))
-	    load_poshistory();
     }
+    if (ISSET(HISTORYLOG))
+	load_history();
+    if (ISSET(POS_HISTORY))
+	load_poshistory();
 #endif /* !DISABLE_NANORC */
 
     /* Set up the backup directory (unless we're using restricted mode,